diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-12-05 23:24:55 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 1999-12-05 23:24:55 +0000 |
commit | 571f48d0b0e71e2f9b9817d653bf5d4ed6fd3681 (patch) | |
tree | e25c3d29c9c92fed488e03459b2aee558b1a8d25 /mtab.c | |
parent | c37f3717d32c57123c1466da4a1f2cdf6565fc36 (diff) | |
download | busybox-w32-571f48d0b0e71e2f9b9817d653bf5d4ed6fd3681.tar.gz busybox-w32-571f48d0b0e71e2f9b9817d653bf5d4ed6fd3681.tar.bz2 busybox-w32-571f48d0b0e71e2f9b9817d653bf5d4ed6fd3681.zip |
Stuf
git-svn-id: svn://busybox.net/trunk/busybox@154 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'mtab.c')
-rw-r--r-- | mtab.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -26,8 +26,14 @@ erase_mtab(const char * name) | |||
26 | FILE *mountTable = setmntent(mtab_file, "r"); | 26 | FILE *mountTable = setmntent(mtab_file, "r"); |
27 | struct mntent * m; | 27 | struct mntent * m; |
28 | 28 | ||
29 | if ( mountTable == 0 | 29 | /* Check if reading the mtab file failed */ |
30 | && (mountTable = setmntent("/proc/mounts", "r")) == 0 ) { | 30 | if ( mountTable == 0 |
31 | #if ! defined BB_FEATURE_USE_PROCFS | ||
32 | ) { | ||
33 | #else | ||
34 | /* Bummer. fall back on trying the /proc filesystem */ | ||
35 | && (mountTable = setmntent("/proc/mounts", "r")) == 0 ) { | ||
36 | #endif | ||
31 | perror(mtab_file); | 37 | perror(mtab_file); |
32 | return; | 38 | return; |
33 | } | 39 | } |
@@ -76,13 +82,14 @@ write_mtab(char* blockDevice, char* directory, | |||
76 | if ( length > 1 && directory[length - 1] == '/' ) | 82 | if ( length > 1 && directory[length - 1] == '/' ) |
77 | directory[length - 1] = '\0'; | 83 | directory[length - 1] = '\0'; |
78 | 84 | ||
85 | #ifdef BB_FEATURE_USE_PROCFS | ||
79 | if ( filesystemType == 0 ) { | 86 | if ( filesystemType == 0 ) { |
80 | struct mntent * p | 87 | struct mntent *p = findMountPoint(blockDevice, "/proc/mounts"); |
81 | = findMountPoint(blockDevice, "/proc/mounts"); | ||
82 | 88 | ||
83 | if ( p && p->mnt_type ) | 89 | if ( p && p->mnt_type ) |
84 | filesystemType = p->mnt_type; | 90 | filesystemType = p->mnt_type; |
85 | } | 91 | } |
92 | #endif | ||
86 | m.mnt_fsname = blockDevice; | 93 | m.mnt_fsname = blockDevice; |
87 | m.mnt_dir = directory; | 94 | m.mnt_dir = directory; |
88 | m.mnt_type = filesystemType ? filesystemType : "default"; | 95 | m.mnt_type = filesystemType ? filesystemType : "default"; |