mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Fix two bugs reported by Ralph Jones.
This commit is contained in:
parent
b0aca921be
commit
e6bf66eada
10
mount.c
10
mount.c
@ -381,9 +381,13 @@ extern int mount_main(int argc, char **argv)
|
|||||||
if (!all && optind == argc)
|
if (!all && optind == argc)
|
||||||
show_mounts();
|
show_mounts();
|
||||||
|
|
||||||
if (optind < argc)
|
if (optind < argc) {
|
||||||
if (realpath(argv[optind], device) == NULL)
|
/* Don't canonicalize NFS devices. */
|
||||||
|
if (strchr(argv[optind], ':') != NULL)
|
||||||
|
safe_strncpy(device, argv[optind], PATH_MAX);
|
||||||
|
else if (realpath(argv[optind], device) == NULL)
|
||||||
perror_msg_and_die("%s", device);
|
perror_msg_and_die("%s", device);
|
||||||
|
}
|
||||||
|
|
||||||
if (optind + 1 < argc)
|
if (optind + 1 < argc)
|
||||||
if (realpath(argv[optind + 1], directory) == NULL)
|
if (realpath(argv[optind + 1], directory) == NULL)
|
||||||
@ -444,7 +448,7 @@ singlemount:
|
|||||||
if (fstabmount == TRUE)
|
if (fstabmount == TRUE)
|
||||||
endmntent(f);
|
endmntent(f);
|
||||||
|
|
||||||
if (all == FALSE && fstabmount == TRUE && optind + 1 == argc)
|
if (all == FALSE && fstabmount == TRUE && m == NULL)
|
||||||
fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
|
fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -381,9 +381,13 @@ extern int mount_main(int argc, char **argv)
|
|||||||
if (!all && optind == argc)
|
if (!all && optind == argc)
|
||||||
show_mounts();
|
show_mounts();
|
||||||
|
|
||||||
if (optind < argc)
|
if (optind < argc) {
|
||||||
if (realpath(argv[optind], device) == NULL)
|
/* Don't canonicalize NFS devices. */
|
||||||
|
if (strchr(argv[optind], ':') != NULL)
|
||||||
|
safe_strncpy(device, argv[optind], PATH_MAX);
|
||||||
|
else if (realpath(argv[optind], device) == NULL)
|
||||||
perror_msg_and_die("%s", device);
|
perror_msg_and_die("%s", device);
|
||||||
|
}
|
||||||
|
|
||||||
if (optind + 1 < argc)
|
if (optind + 1 < argc)
|
||||||
if (realpath(argv[optind + 1], directory) == NULL)
|
if (realpath(argv[optind + 1], directory) == NULL)
|
||||||
@ -444,7 +448,7 @@ singlemount:
|
|||||||
if (fstabmount == TRUE)
|
if (fstabmount == TRUE)
|
||||||
endmntent(f);
|
endmntent(f);
|
||||||
|
|
||||||
if (all == FALSE && fstabmount == TRUE && optind + 1 == argc)
|
if (all == FALSE && fstabmount == TRUE && m == NULL)
|
||||||
fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
|
fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user