From 83eba401bb87038effa4012d2949c6d4a006559e Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Mon, 18 Aug 2008 12:33:02 +0200 Subject: Revert "- Add comment to bug." This reverts commit c2289bd5e2bdb03230d75b7a05a3f053c1bafe6e. --- TODO | 5 ++++- src/mfs_subr.c | 2 ++ src/mfs_vnops.c | 15 +++++---------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index d1a4de5..b1bde44 100644 --- a/TODO +++ b/TODO @@ -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); } -- cgit v1.2.3