From bf71ef0797c42f4b1754ec8756819c633a0d0d73 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 10 Mar 2010 23:59:33 +0100 Subject: [PATCH] swapon: use unmangle() for filenames from /proc/swaps linux kernel encodes all garbage in filenames by mangle() function. We need to unmagle() to get the real filenames. Signed-off-by: Karel Zak --- mount/Makefile.am | 3 ++- mount/swapon.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mount/Makefile.am b/mount/Makefile.am index c5f58aa3..76940306 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -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) diff --git a/mount/swapon.c b/mount/swapon.c index 9f702ecb..501254bc 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -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); } -- 2.39.5