Add more loggine of errors
authorSteve McIntyre <steve@einval.com>
Sun, 23 Jan 2011 02:23:37 +0000 (02:23 +0000)
committerSteve McIntyre <steve@einval.com>
Sun, 23 Jan 2011 02:23:37 +0000 (02:23 +0000)
C/fuse-music.c

index 77c8c9b..c218a7a 100644 (file)
@@ -584,8 +584,10 @@ static int fm_getattr(const char *path, struct stat *stbuf)
             error = enqueue_encode_file(flac_path);
             if (error)
             {
+                fprintf(logfile, "%s: encoding %s failed with error %d\n",
+                        __func__, flac_path, error);
                 free(flac_path);
-                return -error;
+                return -EIO;
             }
 
             /* Encoding should have updated the database, so look again */
@@ -693,8 +695,10 @@ static int fm_open(const char *path, struct fuse_file_info *fi)
             error = enqueue_encode_file(flac_path);
             if (error)
             {
+                fprintf(logfile, "%s: encoding %s failed with error %d\n",
+                        __func__, flac_path, error);
                 free(flac_path);
-                return -errno;
+                return -EIO;
             }
             cache_file_name = cache_lookup_for_read(mo.basedir, flac_path);
             if (NULL == cache_file_name)
@@ -753,8 +757,10 @@ static int fm_read(const char *path, char *buf, size_t size, off_t offset,
     (void) path;
     res = pread(fi->fh, buf, size, offset);
     if (res == -1)
+    {
+        fprintf(logfile, "%s: failed, error %d\n", __func__, errno);
         res = -errno;
-
+    }
     return res;
 }