diff options
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | src/mfs_subr.c | 2 | ||||
-rwxr-xr-x | src/mfs_vnops.c | 15 |
3 files changed, 11 insertions, 11 deletions
@@ -5,10 +5,13 @@ v. 0.1 * Better interface (the new .config is pretty good, but needs improvement) -* BUG: musicfs only works in debug mode. Why? Fix this! +* BUG: musicfs only works in debug mode. * -f (foreground mode) also works * -s (single thread) does not + Update: This works if I disable DEBUGGING, probably because of some permission + problems when using file I/O in not debugging mode. + * BUG: what to do with songs without tags? The current behavior, breaking badly, is probably not what we want. Suggestions: * We put all songs not having complete tags in an Unsorted folder, with the diff --git a/src/mfs_subr.c b/src/mfs_subr.c index b83c75d..420046b 100644 --- a/src/mfs_subr.c +++ b/src/mfs_subr.c @@ -62,6 +62,8 @@ char *mfs_get_home_path(const char *extra) char *res; const char *home = getenv("HOME"); + if (home == NULL) + return (NULL); hlen = strlen(home); exlen = (extra != NULL) ? strlen(extra) : 0; diff --git a/src/mfs_vnops.c b/src/mfs_vnops.c index 9af8a2f..da23177 100755 --- a/src/mfs_vnops.c +++ b/src/mfs_vnops.c @@ -42,6 +42,7 @@ static int mfs_getattr (const char *path, struct stat *stbuf) { char *realpath; + int res; int status = 0; memset (stbuf, 0, sizeof (struct stat)); @@ -56,7 +57,7 @@ static int mfs_getattr (const char *path, struct stat *stbuf) char *mfsrc = mfs_get_home_path(".mfsrc"); if (mfsrc == NULL) return (-ENOMEM); - int res = stat(mfsrc, stbuf); + res = stat(mfsrc, stbuf); DEBUG("stat result for %s: %d\n", mfsrc, res); free(mfsrc); return (res); @@ -75,17 +76,11 @@ static int mfs_getattr (const char *path, struct stat *stbuf) status = mfs_realpath(path, &realpath); if (status != 0) return status; - if (stat(realpath, stbuf) != 0) { - free(realpath); - return -ENOENT; - } + res = stat(realpath, stbuf); free(realpath); - return 0; - - case MFS_NOTFOUND: - default: - return -ENOENT; + return (res); } + return (-ENOENT); } |