]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - db.c
db.c find_audio_files(): use int rather than char for cwd_fd
[paraslash.git] / db.c
diff --git a/db.c b/db.c
index 9db622bca3ca6447fcc1659a0c270d49d2b36f60..027dfda5933ca79fe9bebbe22c3a1d5e97f16a9c 100644 (file)
--- a/db.c
+++ b/db.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
  *
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 #include "server.cmdline.h"
 #include "server.h"
-#include "afs.h"
+#include "vss.h"
 #include <dirent.h> /* readdir() */
 #include <sys/stat.h> /* stat */
 #include <sys/types.h> /* mode_t */
@@ -50,7 +50,7 @@ int find_audio_files(const char *dirname, int (*f)(const char *, const char *))
         * is usually faster and more reliable than saving cwd in some buffer
         * and calling chdir() afterwards (see man 3 getcwd).
         */
-       char cwd_fd = open(".", O_RDONLY);
+       int cwd_fd = open(".", O_RDONLY);
        struct stat s;
        int ret = -1;
 
@@ -75,14 +75,15 @@ int find_audio_files(const char *dirname, int (*f)(const char *, const char *))
                        continue;
                ret = -E_LSTAT;
                if (lstat(entry->d_name, &s) == -1)
-                       goto out;
+                       continue;
                m = s.st_mode;
                if (!S_ISREG(m) && !S_ISDIR(m)) /* skip links, sockets, ... */
                        continue;
                if (S_ISREG(m)) { /* regular file */
                        if (guess_audio_format(entry->d_name) < 0)
                                continue;
-                       if (f(dirname, entry->d_name) < 0)
+                       ret = f(dirname, entry->d_name);
+                       if (ret < 0)
                                goto out;
                        continue;
                }