42 lines
942 B
Diff
42 lines
942 B
Diff
|
Index: util-linux-ng-2.18/mount/swapon.c
|
||
|
===================================================================
|
||
|
--- util-linux-ng-2.18.orig/mount/swapon.c
|
||
|
+++ util-linux-ng-2.18/mount/swapon.c
|
||
|
@@ -23,6 +23,7 @@
|
||
|
#include "pathnames.h"
|
||
|
#include "swapheader.h"
|
||
|
#include "mangle.h"
|
||
|
+#include "canonicalize.h"
|
||
|
|
||
|
#define PATH_MKSWAP "/sbin/mkswap"
|
||
|
|
||
|
@@ -171,7 +172,11 @@ read_proc_swaps(void) {
|
||
|
break;
|
||
|
swapFiles = q;
|
||
|
|
||
|
- swapFiles[numSwaps++] = unmangle(line);
|
||
|
+ if ((p = unmangle(line)) == NULL)
|
||
|
+ break;
|
||
|
+
|
||
|
+ swapFiles[numSwaps++] = canonicalize_path(p);
|
||
|
+ free(p);
|
||
|
}
|
||
|
fclose(swaps);
|
||
|
}
|
||
|
@@ -179,10 +184,14 @@ read_proc_swaps(void) {
|
||
|
static int
|
||
|
is_in_proc_swaps(const char *fname) {
|
||
|
int i;
|
||
|
+ char *p = canonicalize_path(fname);
|
||
|
|
||
|
for (i = 0; i < numSwaps; i++)
|
||
|
- if (swapFiles[i] && !strcmp(fname, swapFiles[i]))
|
||
|
+ if (swapFiles[i] && !strcmp(p, swapFiles[i])) {
|
||
|
+ free(p);
|
||
|
return 1;
|
||
|
+ }
|
||
|
+ free(p);
|
||
|
return 0;
|
||
|
}
|
||
|
|