diff options
author | Rob Landley <rob@landley.net> | 2005-12-20 17:18:01 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-12-20 17:18:01 +0000 |
commit | 7b363fd3c904c2530844150d00b99f7b32d97f05 (patch) | |
tree | 049af302e9ac23b2b8ed7fd58d87d7f058cdad66 /util-linux/mount.c | |
parent | b9620414c19399bd9da2b90b3ab7b9a832e0be1a (diff) | |
download | busybox-w32-7b363fd3c904c2530844150d00b99f7b32d97f05.tar.gz busybox-w32-7b363fd3c904c2530844150d00b99f7b32d97f05.tar.bz2 busybox-w32-7b363fd3c904c2530844150d00b99f7b32d97f05.zip |
Some minor cleanups/bugfixes split off from the big remount work:
Shorten GPL boilerplate.
Enabling FEATURE_CLEAN_UP broke things in two places.
Move the NFS with uClibc check to nfsmount.c
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r-- | util-linux/mount.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index cc6b73eb0..4b8e81ca1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -6,20 +6,7 @@ | |||
6 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> | 6 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
7 | * Copyright (C) 2005 by Rob Landley <rob@landley.net> | 7 | * Copyright (C) 2005 by Rob Landley <rob@landley.net> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | 10 | */ |
24 | 11 | ||
25 | #include <limits.h> | 12 | #include <limits.h> |
@@ -35,12 +22,6 @@ | |||
35 | #include <sys/ioctl.h> // for CONFIG_FEATURE_MOUNT_LOOP | 22 | #include <sys/ioctl.h> // for CONFIG_FEATURE_MOUNT_LOOP |
36 | #include "busybox.h" | 23 | #include "busybox.h" |
37 | 24 | ||
38 | /* This is just a warning of a common mistake. Possibly this should be a | ||
39 | * uclibc faq entry rather than in busybox... */ | ||
40 | #if ENABLE_FEATURE_MOUNT_NFS && defined(__UCLIBC__) && ! defined(__UCLIBC_HAS_RPC__) | ||
41 | #error "You need to build uClibc with UCLIBC_HAS_RPC for busybox mount with NFS support to compile." | ||
42 | #endif | ||
43 | |||
44 | // These two aren't always defined in old headers | 25 | // These two aren't always defined in old headers |
45 | #ifndef MS_BIND | 26 | #ifndef MS_BIND |
46 | #define MS_BIND 4096 | 27 | #define MS_BIND 4096 |
@@ -182,7 +163,7 @@ extern int mount_main(int argc, char **argv) | |||
182 | while (getmntent_r(mountTable,&m,path,sizeof(path))) { | 163 | while (getmntent_r(mountTable,&m,path,sizeof(path))) { |
183 | blockDevice = m.mnt_fsname; | 164 | blockDevice = m.mnt_fsname; |
184 | 165 | ||
185 | // Clean up display a little bit regarding root devie | 166 | // Clean up display a little bit regarding root device |
186 | if(!strcmp(blockDevice, "rootfs")) continue; | 167 | if(!strcmp(blockDevice, "rootfs")) continue; |
187 | if(!strcmp(blockDevice, "/dev/root")) | 168 | if(!strcmp(blockDevice, "/dev/root")) |
188 | blockDevice = find_block_device("/"); | 169 | blockDevice = find_block_device("/"); |
@@ -260,7 +241,7 @@ extern int mount_main(int argc, char **argv) | |||
260 | free(blockDevice); | 241 | free(blockDevice); |
261 | blockDevice=strdup(m.mnt_fsname); | 242 | blockDevice=strdup(m.mnt_fsname); |
262 | free(directory); | 243 | free(directory); |
263 | directory=strdup(m.mnt_type); | 244 | directory=strdup(m.mnt_dir); |
264 | } else { | 245 | } else { |
265 | blockDevice=m.mnt_fsname; | 246 | blockDevice=m.mnt_fsname; |
266 | directory=m.mnt_dir; | 247 | directory=m.mnt_dir; |
@@ -387,16 +368,16 @@ mount_it_now: | |||
387 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); | 368 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); |
388 | } | 369 | } |
389 | // We couldn't free this earlier becase fsType could be in buf. | 370 | // We couldn't free this earlier becase fsType could be in buf. |
390 | if(ENABLE_FEATURE_CLEAN_UP) { | 371 | if(ENABLE_FEATURE_CLEAN_UP) free(buf); |
391 | free(buf); | ||
392 | free(blockDevice); | ||
393 | free(directory); | ||
394 | } | ||
395 | if(!all) break; | 372 | if(!all) break; |
396 | } | 373 | } |
397 | 374 | ||
398 | if(file) endmntent(file); | 375 | if(file) endmntent(file); |
399 | if(rc) bb_perror_msg("Mounting %s on %s failed", blockDevice, directory); | 376 | if(rc) bb_perror_msg("Mounting %s on %s failed", blockDevice, directory); |
377 | if(ENABLE_FEATURE_CLEAN_UP) { | ||
378 | free(blockDevice); | ||
379 | free(directory); | ||
380 | } | ||
400 | 381 | ||
401 | return rc; | 382 | return rc; |
402 | } | 383 | } |