summaryrefslogtreecommitdiffstats
path: root/sys-utils/umount.c
Commit message (Collapse)AuthorAgeFilesLines
* umount: be more strict about --allKarel Zak2019-06-061-0/+4
| | | | | | | | | | | | If you by accident execute umount ls -al /mnt/ then umount --all is executed and another arguments silently ignored. It seems better to be more strict in this case. Reported-by: Harald Dunkel <harald.dunkel@aixigo.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-7/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: add print_version() macroKarel Zak2019-04-161-2/+2
| | | | | | | | | | | Let's consolidate the version printing code. It also seems better to use exit() after --version, because it's handled in different way by ASAN. It's strange, but ASAN reports leaks after return in main(). Note that we do not use free-before-exit. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix --quietKarel Zak2018-12-101-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/commit/d5fd9ac6b208c5acdb6c0023757a7e2827474482#commitcomment-31610748 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add --quiet optionKarel Zak2018-08-011-3/+21
| | | | | | | | | | | | | | | The command umount supports things like --all-targets and --recursive to umount all nodes in specified tree. Sometimes it makes sense to aggressively use wildcards like /dev/sdb* and in this case --quiet seems like a good choice umount --quiet --all-targets /dev/sdb* to suppress 'not mounted' error messages. The new option suppress only these error messages and nothing else. Addresses: https://github.com/karelzak/util-linux/issues/672 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix behaviour of -A and -R with --namespaceVaclav Dolezal2018-06-111-1/+10
| | | | | | | Load /proc/self/mountinfo from correct namespace. Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: allow PID as --namespace argumentVaclav Dolezal2018-06-111-2/+22
| | | | | | | [kzak@redhat.com: - update code] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* mount: document --namespace in man/helpVaclav Dolezal2018-06-111-0/+1
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: make errno usable after mnt_context_set_target_ns()Karel Zak2018-06-111-6/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add support for namespacesVaclav Dolezal2018-06-111-1/+11
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* nls: remove translation stringsSami Kerola2018-05-281-1/+1
| | | | | | | | | | While looking earlier commit I noticed everything but formatting was removed from a message in namei.c file. That inspired me to look if there are more strings that does not need translation project attention. This change removes at least some of them, if not all. Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-4/+6
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix optutils.h related exit codesRuediger Meier2017-06-221-1/+3
| | | | | | | | | Found by: grep -L "OPTUTILS_EXIT_CODE" $(grep -l "err_exclusive_options" \ $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix xalloc.h related exit codesRuediger Meier2017-06-221-0/+2
| | | | | | | | | Found by: grep -L "XALLOC_EXIT_CODE" $(grep -l "xalloc\.h" \ $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* umount: use MNT_EX_* from libmountKarel Zak2017-04-271-28/+27Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mount, umount: use mnt_context_get_excode()Karel Zak2017-04-271-114/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix typoKarel Zak2017-04-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-17/+17
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* umount: exclude selinuxfs from --allKarel Zak2017-02-091-1/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1417722 Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+1Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-3/+3
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messagesBenno Schulenberg2016-03-161-2/+1Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed linesKarel Zak2015-10-151-1/+1
| | | | | | | | | | | | | | | | | The libmount provides way how to deal with parsing errors in fstab -- on error callback function is executed and according to the return libmount manipulate with the malformed line, possible are three states: 1/ fatal error; all file ignored (callback rc < 0) 2/ recoverable error; malformed line ignored (callback rc > 0) 3/ ignore the error (callback rc == 0) The 2/ is the default if no callback specified. Unfortunately our utils uses 3/. The correct way is to use 2/. Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* umount: fix memory leak [coverity scan]Karel Zak2014-07-171-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: Make sure exit code does not overflowNicolas Boichat2014-06-071-1/+1
| | | | | | | | | | | | | | | | POSIX exit code is only 8-bit, and since umount sums up error codes, it can sometimes report success (exit code 0) even though a number of operations failed. For example, running, in an empty directory: umount `seq 1 7` returns 224 (7*32), since none of the 7 mount point exists but umount `seq 1 8` returns 0 (8*32=256) This patch clips the return value to 255. Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
* umount: add info that --all-targets works with mtab symlink onlyKarel Zak2014-05-261-1/+3
| | | | | Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix typo in usageJonathan Liu2014-04-071-1/+1
| | | | Signed-off-by: Jonathan Liu <net147@gmail.com>
* umount: more robust success message for --allKarel Zak2014-04-071-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix umount by tag for non-rootsKarel Zak2013-11-191-3/+5
| | | | | | | | | $ umount LABEL=foo currently does not work for non-root users as umount uses the LABEL= as a path in sanitize_path(). Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: provide more helpful error messageKarel Zak2013-09-271-0/+6
| | | | | | | | | | | | | | | non-root user on device that is not mounted: $ umount /mnt/flash umount: /mnt/flash: umount failed: Operation not permitted this is true, because we cannot evaluate permissions as there is no entry in mtab, but users expect something more helpful -- for example umount: /mnt/flash: not mounted References: https://bugs.archlinux.org/task/31647 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use libmnt_table reference counterKarel Zak2013-08-211-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: be robust for empty target/source stringsKarel Zak2013-06-171-1/+4
| | | | | | | | | | * lib/canonicalize.c: don't interpret empty strings as relative paths * libmount: more robust libmnt_table find function and debug messages References: https://bugzilla.novell.com/show_bug.cgi?id=825150 Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix several typos and angular brackets in messagesBenno Schulenberg2013-06-071-12/+12
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* umount: use devno to identify --all-target devicesKarel Zak2013-04-231-5/+4Star
| | | | | | | | | | | | | | # mount -t tmpfs tmp /mnt/A # mount --bind /mnt/A /mnt/B # mount -t tmpfs tmp /mnt/C the command: umount --all-targets /mnt/A has to umount only A and B, but not C. The C is a another filesystem. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add note about namespaces too --all-targetsKarel Zak2013-02-271-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add --all-targetsKarel Zak2013-02-261-59/+129
| | | | | | | | | | | | | | | | | | | | | The same source (whole filesystem or filesystems subvolume) could be mounted on more targets (mountpoints). For example bind mounts or btrfs sub-volumes. If you want to detach the source device from the system then you need to unmount all the mountpoints. umount --all-targets <device|mountpoint> provides this functionality. This option could be used together with --recursive. Then all nested mountpoints within the filesystem are unmounted too. For example: umount --recursive --all-targets /dev/sdb1 should be a way how to make the device unmounted at all. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: make usage() translator friendlySami Kerola2013-01-251-16/+13Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* umount: sanitize paths from non-root usersKarel Zak2012-11-261-2/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: (recursive) add a cache to the tableDave Reisner2012-11-161-0/+2
| | | | | | | | | | | Without this table libmount will not resolve paths, meaning that umounting by relative path will fail. [kzak@redhat.com: - use mnt_context_get_cache() to make it sensitive to --no-canonicalize cmdline option] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: (recursive) don't call umount(2) for already unmounted targetsKarel Zak2012-11-151-7/+31
| | | | | | | | | In the umount --recursive we follow entries from mountinfo, but the entries maybe already obsolete. Especially if the hierarchy of the mountpoints contains shared subtrees and umount(2) for one entry may generate umount for some other entry too. Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: clean --recursiveKarel Zak2012-11-151-0/+17
| | | | | | | - mark some options combinations mutually exclusive - reset libmount context before next umount (this is important!) Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: allways return MOUNT_EX_*Karel Zak2012-11-131-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: add -R, --recursive optionDave Reisner2012-11-131-4/+81
| | | | | | | | | | | This allows unmounting of an entire tree of filesystems, which might be of particular interest for a shutdown initramfs. [kzak@redhat.com: - always return MOUNT_EX_* codes - cosmetic changes on coding style] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add verbose messagesKarel Zak2012-10-091-0/+22
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227 Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: corrections to FSF license files, and postal addressSami Kerola2012-02-241-3/+3
| | | | | | | | | | | | | | The COPYING and Documentation/licenses/COPYING* files are being replaced by files from GNU web site. http://www.gnu.org/licenses/gpl-2.0.txt http://www.gnu.org/licenses/lgpl-2.1.txt Postal addresses to FSF in other files are updated to match with the address in license files. Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>