Line 0
Link Here
|
|
|
1 |
--- lib/ext2fs/ismounted.c.orig Mon Feb 25 05:03:59 2002 |
2 |
+++ lib/ext2fs/ismounted.c Sun Aug 4 02:51:39 2002 |
3 |
@@ -146,50 +146,6 @@ |
4 |
return retval; |
5 |
} |
6 |
|
7 |
-/* |
8 |
- * Check to see if we're dealing with the swap device. |
9 |
- */ |
10 |
-static int is_swap_device(const char *file) |
11 |
-{ |
12 |
- FILE *f; |
13 |
- char buf[1024], *cp; |
14 |
- dev_t file_dev; |
15 |
- struct stat st_buf; |
16 |
- int ret = 0; |
17 |
- |
18 |
- file_dev = 0; |
19 |
-#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ |
20 |
- if (stat(file, &st_buf) == 0) |
21 |
- file_dev = st_buf.st_rdev; |
22 |
-#endif |
23 |
- |
24 |
- if (!(f = fopen("/proc/swaps", "r"))) |
25 |
- return 0; |
26 |
- /* Skip the first line */ |
27 |
- fgets(buf, sizeof(buf), f); |
28 |
- while (!feof(f)) { |
29 |
- if (!fgets(buf, sizeof(buf), f)) |
30 |
- break; |
31 |
- if ((cp = strchr(buf, ' ')) != NULL) |
32 |
- *cp = 0; |
33 |
- if ((cp = strchr(buf, '\t')) != NULL) |
34 |
- *cp = 0; |
35 |
- if (strcmp(buf, file) == 0) { |
36 |
- ret++; |
37 |
- break; |
38 |
- } |
39 |
-#ifndef __GNU__ |
40 |
- if (file_dev && (stat(buf, &st_buf) == 0) && |
41 |
- file_dev == st_buf.st_rdev) { |
42 |
- ret++; |
43 |
- break; |
44 |
- } |
45 |
-#endif |
46 |
- } |
47 |
- fclose(f); |
48 |
- return ret; |
49 |
-} |
50 |
- |
51 |
static errcode_t check_mntent(const char *file, int *mount_flags, |
52 |
char *mtpt, int mtlen) |
53 |
{ |
54 |
@@ -248,6 +204,50 @@ |
55 |
return 0; |
56 |
} |
57 |
#endif /* HAVE_GETMNTINFO */ |
58 |
+ |
59 |
+/* |
60 |
+ * Check to see if we're dealing with the swap device. |
61 |
+ */ |
62 |
+static int is_swap_device(const char *file) |
63 |
+{ |
64 |
+ FILE *f; |
65 |
+ char buf[1024], *cp; |
66 |
+ dev_t file_dev; |
67 |
+ struct stat st_buf; |
68 |
+ int ret = 0; |
69 |
+ |
70 |
+ file_dev = 0; |
71 |
+#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ |
72 |
+ if (stat(file, &st_buf) == 0) |
73 |
+ file_dev = st_buf.st_rdev; |
74 |
+#endif |
75 |
+ |
76 |
+ if (!(f = fopen("/proc/swaps", "r"))) |
77 |
+ return 0; |
78 |
+ /* Skip the first line */ |
79 |
+ fgets(buf, sizeof(buf), f); |
80 |
+ while (!feof(f)) { |
81 |
+ if (!fgets(buf, sizeof(buf), f)) |
82 |
+ break; |
83 |
+ if ((cp = strchr(buf, ' ')) != NULL) |
84 |
+ *cp = 0; |
85 |
+ if ((cp = strchr(buf, '\t')) != NULL) |
86 |
+ *cp = 0; |
87 |
+ if (strcmp(buf, file) == 0) { |
88 |
+ ret++; |
89 |
+ break; |
90 |
+ } |
91 |
+#ifndef __GNU__ |
92 |
+ if (file_dev && (stat(buf, &st_buf) == 0) && |
93 |
+ file_dev == st_buf.st_rdev) { |
94 |
+ ret++; |
95 |
+ break; |
96 |
+ } |
97 |
+#endif |
98 |
+ } |
99 |
+ fclose(f); |
100 |
+ return ret; |
101 |
+} |
102 |
|
103 |
/* |
104 |
* ext2fs_check_mount_point() returns 1 if the device is mounted, 0 |