]>
Commit | Line | Data |
---|---|---|
f212f39a | 1 | When swap is a symlink, the swap entry in |
2 | /etc/fstab may not match /proc/swaps. That | |
3 | means strcmp shouldn't be used for swapon. | |
4 | ||
a7980c08 ER |
5 | --- util-linux-2.12p/sys-utils/swapon.c.sopwith Wed Dec 22 04:50:19 2004 |
6 | +++ util-linux-2.12p/sys-utils/swapon.c Thu Dec 23 14:44:49 2004 | |
f212f39a | 7 | @@ -138,9 +138,19 @@ |
8 | is_in_proc_swaps(const char *fname) { | |
9 | int i; | |
10 | ||
11 | - for (i = 0; i < numSwaps; i++) | |
12 | - if (swapFiles[i] && !strcmp(fname, swapFiles[i])) | |
13 | + for (i = 0; i < numSwaps; i++) { | |
14 | + struct stat swapped, swapping; | |
15 | + | |
16 | + if (!swapFiles[i]) continue; | |
17 | + | |
18 | + if (!strcmp(fname, swapFiles[i]) | |
19 | + || (!stat (swapFiles[i], &swapped) | |
20 | + && !stat (fname, &swapping) | |
21 | + && (swapped.st_dev == swapping.st_dev | |
22 | + && swapped.st_ino == swapping.st_ino)) | |
23 | + ) | |
24 | return 1; | |
25 | + } | |
26 | return 0; | |
27 | } | |
28 |