Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fw32.git;a=commitdiff;h=3a417c72216ac713c5c61552583482d8db274b57
commit 3a417c72216ac713c5c61552583482d8db274b57 Author: James Buren <[email protected]> Date: Thu Nov 3 03:19:04 2011 -0500 fw32.c: fix umount_all diff --git a/fw32.c b/fw32.c index 8e83c59..65115be 100644 --- a/fw32.c +++ b/fw32.c @@ -239,40 +239,26 @@ mount_all(void) { const char **p; - for( p = FW32_DIRS ; *p ; ++p ) - mount_directory(*p); + p = FW32_DIRS; + + while(*p) + mount_directory(*p++); } static void umount_all(void) { - FILE *f; - char line[LINE_MAX], *s, *e; - - f = fopen("/proc/mounts","rb"); + const char **p; + char path[PATH_MAX]; - if(!f) - error("Cannot open /proc/mounts for reading.\n"); + p = FW32_DIRS; - while(fgets(line,sizeof line,f)) + while(*p) { - s = strchr(line,' '); - - if(!s) - continue; - - e = strchr(++s,' '); - - if(!e) - continue; - - *e = 0; + snprintf(path,sizeof path,"%s%s",FW32_ROOT,*p++); - if(!strncmp(s,FW32_ROOT,strlen(FW32_ROOT))) - umount_directory(s); + umount_directory(path); } - - fclose(f); } static void _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
