summaryrefslogtreecommitdiffstats
path: root/sys-utils/mountpoint.c
Commit message (Collapse)AuthorAgeFilesLines
* mountpoint: add --nofollow optionSami Kerola2019-08-021-3/+16
| | | | | | | | | | The no follow option will allow user to distinct mount points from symbolic links pointing to them. Arguably this is pretty pedantic option, mounting a device or bind mount to a directory via symlink does not have or cause any issues. Addresses: https://github.com/karelzak/util-linux/issues/832 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: simplify test condition [cppcheck]Sami Kerola2018-05-281-2/+1Star
| | | | | | | [sys-utils/mountpoint.c:79]: (style) Redundant condition: ctl->st.st_dev==pst.st_dev. 'A || (!A && B)' is equivalent to 'A || B' 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-5/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-7/+7
| | | | | | | | | | 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>
* 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-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* Revert "include sysmacros.h where used"Karel Zak2016-03-081-1/+0Star
| | | | This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.
* include sysmacros.h where usedMike Frysinger2016-03-081-0/+1
| | | | | | | | BSD/Linux systems stick major/minor/makedev in sysmacros.h. Newer Linux libraries have been moving away from including sysmacros.h implicitly via sys/types.h, so include it directly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-1/+1
| | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. 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>
* mountpoint: simplify if statementSami Kerola2014-09-191-14/+11Star
| | | | | | | Returning straight after print_devno() makes the code to be more obvious and removes need for long else statement. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mountpoint: add struct mountpoint_controlSami Kerola2014-09-191-45/+41Star
| | | | | | | This unifies variable names in different functions, and removes redundant stat() calls. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mountpoint: drop S_ISDIR checkDave Reisner2014-08-211-6/+0Star
| | | | Files can be mountpoints, too.
* misc: use libmnt_table reference counterKarel Zak2013-08-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use libmnt_cache reference countingKarel Zak2013-08-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: don't hardcode pathsKarel Zak2013-02-141-1/+2
| | | | 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>
* mountpoint: add --version & align with howto-usage-function.txtSami Kerola2012-03-301-7/+12
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mountpoint: account for error from in mnt_fs_get_targetDave Reisner2012-03-021-2/+5
| | | | | | | | | | | commit 04f087ec didn't take into consideration that mnt_fs_get_target() could return an error, and would therefore show false positives, such as: $ mkdir foo; mountpoint foo foo is a mountpoint Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* mountpoint: fix a minor bug with 0:0 devnoZhi Li2012-02-291-12/+13
| | | | | | | | | | | | | | | | | zhi@debian-lizhi:~$ mountpoint /sys /sys is not a mountpoint zhi@debian-lizhi:~$ The problem is in mountpoint.c, function dir_to_device(), which uses 0 as an error return value, but for sysfs 0 is its device number: zhi@debian-lizhi:~$ cat /proc/self/mountinfo 14 19 0:0 / /sys rw,nosuid,nodev,noexec,relatime - sysfs none rw 15 19 0:3 / /proc rw,nosuid,nodev,noexec,relatime - proc none rw My change is on dir_to_device, seperating device number from return value. Signed-off-by: Zhi Li <lizhi1215@gmail.com>
* 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>
* mountpoint: support symbolic and relative pathsKarel Zak2011-10-111-2/+12
| | | | | Reported-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "mountpoint: refactor exit path"Karel Zak2011-10-111-16/+10Star
| | | | | | This change is unnecessary, we can use libmount stuff for everything. This reverts commit b16b56ec55507b6b83e0d35e3cefeb16367f3363.
* mountpoint: refactor exit pathDave Reisner2011-10-111-10/+16
| | | | | | | | | | | There's only one condition for which we declare success, but many for failure. Initialize rc as failure and set to success on this single condition. In all cases, jump to a label to exit instead of exiting immediately. This will be used later on to ease cleanup of any heap allocations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: fallback on stat when /proc isn't mountedKarel Zak2011-10-111-1/+23
| | | | | Reported-by: <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: return dev_t from dir_to_deviceDave Reisner2011-10-111-7/+6Star
| | | | | | | | | | | | The string returned from this function was never of much use other than to stat the path when the user requested a major:minor pair beyond the true/false exit. Save some processing and directly returning the dev_t on success, and an impossible value on failure. [kzak@redhat.com: - use 0 as dir_to_device() return value on failure] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: cleanup usage()Karel Zak2011-08-161-12/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix 'make checkincludes' warningsKarel Zak2011-07-281-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: add new commandKarel Zak2011-06-211-0/+174
This is libmount based re-implementation of the mountpoint(1) command. The original implementation is maintained in sysvinit suite. The mountpoint(1) in util-linux is not enabled by default (for now) -- use --enable-mountpoint to enable the util. Signed-off-by: Karel Zak <kzak@redhat.com>