aboutsummaryrefslogtreecommitdiff
path: root/sutils/fstab.c
Commit message (Collapse)AuthorAgeFilesLines
* Simplify deallocations.Justus Winter2017-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | free (NULL) is a nop, therefore it is not necessary to check that first. Simplify the code accordingly. This commit is the result of the following semantic patch: @@ identifier X; @@ -if (X) free (X); +free (X); * console-client/console.c: Simplify accordingly. * console-client/driver.c: Likewise. * console-client/vga.c: Likewise. * ftpfs/dir.c: Likewise. * libftpconn/unix.c: Likewise. * libps/fmt.c: Likewise. * libps/proclist.c: Likewise. * libstore/mvol.c: Likewise. * nfs/ops.c: Likewise. * proc/host.c: Likewise. * sutils/fstab.c: Likewise.
* Also do not realpath "proc" pseudo-deviceSamuel Thibault2015-09-081-1/+1
| | | | * sutils/fstab.c (fstab_find_device): Do not realpath "proc" pseudo-device.
* Replace `bzero' with `memset'Justus Winter2014-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For reference, this patch was created using the following semantic patch, and then manually applying the change in all functions containing nested functions, as those are not supported by Coccinelle. @@ expression A, B; @@ - bzero (A, B) + memset (A, 0, B) * auth/auth.c: Replace `bzero' with `memset'. * boot/boot.c: Likewise. * defpager/defpager.c: Likewise. * exec/exec.c: Likewise. Also, drop `safe_bzero' and just use `hurd_safe_memset' directly. * ext2fs/ext2fs.c: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/pager.c: Likewise. * fatfs/pager.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/netfs.c: Likewise. * isofs/inode.c: Likewise. * isofs/pager.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-statfs.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/start-translator.c: Likewise. * libftpconn/create.c: Likewise. * libftpconn/open.c: Likewise. * libftpconn/unix.c: Likewise. * libpipe/pipe.c: Likewise. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/ugids.c: Likewise. * libstore/argp.c: Likewise. * libstore/enc.c: Likewise. * libstore/kids.c: Likewise. * libthreads/alpha/thread.c: Likewise. * libtreefs/fsys.c: Likewise. * libtrivfs/file-statfs.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/glue-include/asm/uaccess.h: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/options.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pflocal/io.c: Likewise. * startup/startup.c: Likewise. * storeio/storeio.c: Likewise. * sutils/fstab.c: Likewise. * usermux/usermux.c: Likewise. * utils/fakeauth.c: Likewise. * utils/frobauth.c: Likewise. * utils/login.c: Likewise. * utils/x.c: Likewise.
* Always canonicalize fstab entries with realpathSamuel Thibault2014-11-211-41/+62
| | | | | | | | | | | | To avoid spurious ./, /, symlinks, etc. * sutils/fstab.c (fs_set_mntent): Try to call realpath on mnt_fsname and mnt_dir field of `mntent'. (fstab_find_mount): Try to call realpath on `name' parameter. (fstab_find): Do not try to call realpath. (fstab_read): Reset errno to zero before calling getmntent. * utils/umount.c (main): Do not warn about missing fstab entries for active translators.
* sutils: fix the semantic of -t, --types in fstab.cJustus Winter2013-08-281-76/+27
| | | | | | | | | | | | | | | | | | | | | | | The mount utility on both Linux and FreeBSD allows one to either specify a whitelist or a blacklist of filesystem types to consider for --all. Prefixing the list with "no" indicates that the list is a blacklist. Furthermore, Linux' mount utility ignores a "no" prefix on any entry in the given list. Previously the Hurd variant first applied whitelist containing all positive values given and then filtered the resulting list using all negative values. But this makes little sense because each entry only has one value for the filesystem type (mnt_type) and all values are mutually exclusive. This patch adjusts the fstab handling code so that our mount utility behaves like the Linux mount utility. This code is used by both mount and fsck. The same argumentation applies to fsck as well. Like implemented in Linux mount, any "no" prefix is ignored to retain compatibility with the old behavior. * sutils/fstab.c (fstab_argp_create): Fix semantic of --types.
* sutils: allow multiple entries for the device "none"Justus Winter2013-08-281-2/+10
| | | | | | | | | Previously it was not possible to add two mount entries with the same device information to an fstab structure. This is easily fixed by breaking the assumption, that there is only one possible mount entry for the "none" device as used by many purely virtual file systems. * utils/fstab.c (fstab_find_device): Return NULL if name is "none".
* sutils: fix a compiler warningJustus Winter2013-07-021-1/+1
| | | | | | | | Fix a compiler warning by dropping the const qualifier. It is not appropriate to qualify pointers to dynamically allocated memory as const. * sutils/fstab.c (real_name): Drop const qualifier.
* Fix crash on fstab-existing mountSamuel Thibault2011-05-161-1/+1
| | | | | | | | Fix crash when invoking mount with a pair of parameters which already exists in fstab * sutils/fstab.c (fstab_add_mntent): Do not free `mounted_fs' when it is the same as `fs'.
* fstab_find: also try to call realpath()Samuel Thibault2011-05-161-1/+23
| | | | | | | For symlinks and non-absolute paths. * sutils/fstab.c (fstab_find): Also call `fstab_find_device' and `fstab_find_mount' on path returned by `realpath'.
* 2001-02-18 Marcus Brinkmann <marcus@gnu.org>Marcus Brinkmann2001-02-181-1/+7
| | | | | * fstab.c (STORE): Only copy when field exists (is non-zero). Reported by Alexey Dejeka <alexey@comail.ru>.
* (fstab_argp_create): brainoRoland McGrath1999-11-191-3/+3
|
* 1999-10-01 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1999-11-191-7/+336
| | | | | | | | | | | | | | | | | | | * fstab.c (fstypes_get): Check strdup return for ENOMEM failure. (fstypes_find_program): New function, #if 0'd out for now. (fstab_argp, fstab_argp_create, options, parse_opt): New variables and functions. * fstab.h: Misc comment fixes. (struct fstab_argp_params): New type. (fstab_argp, fstab_argp_create): Declare them. * fsck.c (options): Remove --fstab/-F, --search-fmts/-S, --exclude-root/-R, --exclude/-X, --fstype/-t, --all/-A; all of these are now factored out into fstab_argp. (main): Remove parsing code for options now in fstab_argp. Instead, use fstab_argp as an argp_child and use fstab_argp_create to process the option-parsing results into a struct fstab * to process. * fstab.c (fstab_read): Undo change of 1999-09-17. It should not be necessary at all, given 1999-05-23 change, and: (fstab_find_mount): Do not consider name "ignore" to match any mount.
* 1999-09-17 Thomas Bushnell, BSG <tb@mit.edu>Thomas Bushnell1999-09-171-0/+4
| | | | | * fstab.c (fstab_read): Ignore filesystems with types of ignore, nfs, or swap.
* 1999-06-11 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1999-06-111-1/+2
| | | | * fstab.c (fstypes_get): Don't free PROGRAM twice on ENOENT failure.
* 1999-05-23 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1999-05-231-13/+20
| | | | | | * fstab.c, fstab.h: Add numerous `const' qualifiers. * fstab.c (fstab_find_mount): Don't count "none" or "-" as matching any other entry.
* 1998-11-29 Roland McGrath <roland@baalperazim.frob.com>Roland McGrath1998-11-291-1/+1
| | | | * fstab.c: Rename fsys_remount -> fsys_update in extern decl.
* Add braces to silence gcc warnings.Roland McGrath1998-10-201-12/+16
|
* (_fs_check_mounted):Miles Bader1997-08-201-1/+1
| | | | file_get_translator_cntl can also return ENXIO for an inactive translator.
* (fstypes_get):Miles Bader1997-02-051-17/+29
| | | | | | | Improve error behavior a bit. Fill in FSTYPE in the case where we added a new type. (fs_set_mntent): Avoid null deferences.
* (fs_remount):Miles Bader1996-09-231-1/+1
| | | | Use fsys_update instead of fsys_remount.
* (fstab_add_fs): Don't SEGV if COPY is 0.Miles Bader1996-07-031-2/+6
|
* (fstypes_create): Copy SEARCH_FMTS contents into NEW.Miles Bader1996-06-201-17/+44
| | | | | | (fs_set_mntent): Don't keep old fsys fields if the mnt_dir is changed. (fstab_add_mntent): Initialize fields in FS with non-zero values. (_fs_check_mounted): The root is always mounted.
* (fs_set_readonly, fs_remount):Miles Bader1996-06-191-54/+31
| | | | | | | | If fsys_set_options returns EINVAL, return EOPNOTSUPP instead. (fs_set_readonly): Use fsys_set_readonly. (fs_remount): Use fsys_remount. (fs_readonly): Use fsys_get_readonly. (_fs_check_mounted): Use file_name_lookup_carefully.
* Initial revisionMiles Bader1996-06-191-0/+591