]> err.no Git - util-linux/commitdiff
swapon: use unmangle() for filenames from /proc/swaps
authorKarel Zak <kzak@redhat.com>
Wed, 10 Mar 2010 22:59:33 +0000 (23:59 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 10 Mar 2010 22:59:33 +0000 (23:59 +0100)
linux kernel encodes all garbage in filenames by mangle() function. We
need to unmagle() to get the real filenames.

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/Makefile.am
mount/swapon.c

index c5f58aa3f3850173082378384f1ac199c228c68e..7694030622700308c54677684f5aac1871dffc57 100644 (file)
@@ -37,7 +37,8 @@ umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
 umount_LDADD = $(ldadd_common)
 
 swapon_SOURCES = swapon.c swap_constants.h ../lib/linux_version.c \
-       ../lib/blkdev.c ../lib/fsprobe.c ../lib/canonicalize.c
+       ../lib/blkdev.c ../lib/fsprobe.c ../lib/canonicalize.c \
+       ../lib/mangle.c
 swapon_CFLAGS = $(cflags_common)
 swapon_LDADD = $(ldadd_common)
 
index 9f702ecb8c3989353ad80b2b2d516436c30b1acd..501254bc5430a6491ceee1de15f01a41367041bd 100644 (file)
@@ -22,6 +22,7 @@
 #include "fsprobe.h"
 #include "pathnames.h"
 #include "swapheader.h"
+#include "mangle.h"
 
 #define PATH_MKSWAP    "/sbin/mkswap"
 
@@ -173,7 +174,7 @@ read_proc_swaps(void) {
                        break;
                swapFiles = q;
 
-               swapFiles[numSwaps++] = strdup(line);
+               swapFiles[numSwaps++] = unmangle(line);
        }
        fclose(swaps);
 }