From: Karel Zak Date: Thu, 14 Jun 2007 09:53:39 +0000 (+0200) Subject: swapon: cleanup PATH_ macros and tailing white-spaces X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41d8815ab7afb67a8b5b55d514f5e9bbe1b7d9fa;p=util-linux swapon: cleanup PATH_ macros and tailing white-spaces Signed-off-by: Karel Zak --- diff --git a/mount/mount_paths.h b/mount/mount_paths.h index d726d063..06d5ebf2 100644 --- a/mount/mount_paths.h +++ b/mount/mount_paths.h @@ -2,14 +2,18 @@ #define MOUNT_PATHS_H #include + #define _PATH_FSTAB "/etc/fstab" +#define PROC_SWAPS "/proc/swaps" + #ifdef _PATH_MOUNTED -#define MOUNTED_LOCK _PATH_MOUNTED "~" -#define MOUNTED_TEMP _PATH_MOUNTED ".tmp" +# define MOUNTED_LOCK _PATH_MOUNTED "~" +# define MOUNTED_TEMP _PATH_MOUNTED ".tmp" #else -#define MOUNTED_LOCK "/etc/mtab~" -#define MOUNTED_TEMP "/etc/mtab.tmp" +# define MOUNTED_LOCK "/etc/mtab~" +# define MOUNTED_TEMP "/etc/mtab.tmp" #endif + #define LOCK_TIMEOUT 10 #define ETC_FILESYSTEMS "/etc/filesystems" diff --git a/mount/swapon.c b/mount/swapon.c index e5f945ed..b4c84f95 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -1,8 +1,6 @@ /* * A swapon(8)/swapoff(8) for Linux 0.99. - * swapon.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp */ - #include #include #include @@ -17,6 +15,7 @@ #include "nls.h" #include "fsprobe.h" #include "realpath.h" +#include "mount_paths.h" #ifdef HAVE_SYS_SWAP_H # include @@ -31,9 +30,6 @@ #define streq(s, t) (strcmp ((s), (t)) == 0) -#define _PATH_FSTAB "/etc/fstab" -#define PROC_SWAPS "/proc/swaps" - #define QUIET 1 int all = 0; @@ -145,10 +141,10 @@ display_summary(void) char line[1024] ; if ((swaps = fopen(PROC_SWAPS, "r")) == NULL) { - int errsv = errno; + int errsv = errno; fprintf(stderr, "%s: %s: %s\n", progname, PROC_SWAPS, strerror(errsv)); - return -1 ; + return -1; } while (fgets(line, sizeof(line), swaps)) @@ -320,7 +316,7 @@ swapon_all(void) { (!ifexists || !access(special, R_OK))) { /* parse mount options; */ char *opt, *opts = strdup(fstab->mnt_opts); - + for (opt = strtok(opts, ","); opt != NULL; opt = strtok(NULL, ",")) { if (strncmp(opt, "pri=", 4) == 0)