X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fmount.c;h=cc078eba336db7f47ad7bae1a5e9f6826ec0a973;hb=aa1ff2ec590192c168c888a60f5c918143890570;hp=62115bbdbfe579828e92e211670e6f477cd96380;hpb=30ebf04700654deddbf5f57d95e84ec69cea8610;p=nfs-utils.git diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 62115bb..cc078eb 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -203,6 +203,13 @@ create_mtab (void) { int flags; mntFILE *mfp; + /* Avoid writing if the mtab is a symlink to /proc/mounts, since + that would create a file /proc/mounts in case the proc filesystem + is not mounted, and the fchmod below would also fail. */ + if (mtab_is_a_symlink()) { + return EX_SUCCESS; + } + lock_mtab(); mfp = nfs_setmntent (MOUNTED, "a+"); @@ -385,14 +392,6 @@ int main(int argc, char *argv[]) if(!strncmp(progname, "umount", strlen("umount"))) exit(nfsumount(argc, argv)); - if (argv[1] && argv[1][0] == '-') { - if(argv[1][1] == 'V') - printf("%s ("PACKAGE_STRING")\n", progname); - else - mount_usage(); - exit(EX_SUCCESS); - } - if ((argc < 3)) { mount_usage(); exit(EX_USAGE); @@ -400,8 +399,7 @@ int main(int argc, char *argv[]) mount_config_init(progname); - argv[2] = argv[0]; /* so that getopt error messages are correct */ - while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs", + while ((c = getopt_long(argc, argv, "rvVwfno:hs", longopts, NULL)) != -1) { switch (c) { case 'r':