summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* textual: adjust grammar and punctuation of some messagesBenno Schulenberg2015-08-031-3/+3
| | | | | | | Also equalize three messages to one other one, and fix a typo in USE_COLORS_BY_DEFAULT. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libsmartcols: don't link with tinfoKarel Zak2015-07-243-32/+42
| | | | | | | Let's move color names to sequence translation to separate file to make it usable without all the stuff in lib/colors.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* include/xalloc: add err_oom()Karel Zak2015-07-201-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/procutils: add proc_get_cmdline()Karel Zak2015-07-201-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/all-io: read_all() don't retry on EOFKarel Zak2015-07-201-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: merge read_utmp() codeKarel Zak2015-07-162-29/+0Star
| | | | | | | The code is used only in lslogins, so it does not make sense to maintain it in libcommon. Signed-off-by: Karel Zak <kzak@redhat.com>
* rtcwake: improve read_clock_mode()Sami Kerola2015-06-291-0/+3
| | | | | | | | Make skipping two lines more robust, and add message about unexpected adjfile contents when running with --verbose. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/c: Define F_DUPFD_CLOEXEC on kFreeBSD systems if missingGuillem Jover2015-06-081-0/+6
| | | | | | | The kernel of FreeBSD version 10 and higher supports this fcntl command, but the system libc, in this case glibc, might not yet know about it. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* lib/fileutils: Add new dup_fd_cloexec functionGuillem Jover2015-06-081-0/+1
| | | | | | | | This function duplicates and marks a file descriptor as close-on-exec. Takes care of build and run-time support for the fcntl F_DUPFD_CLOEXEC command, and other errors. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* libsmartcols: keep JSON field names lower-caseKarel Zak2015-06-051-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: rename devname functions, cleanupKarel Zak2015-05-281-8/+5Star
| | | | | | | | | | | | | | | | | | Well, I don't have mental power to use function names like sysfs_devname_to_dev_name() so this patch renames to sysfs_devname_sys_to_dev() sysfs_devname_dev_to_sys() It also cleanups usage of the functions. We have to be sure that sysfs.c code returns regular devnames. The existence of the sysfs devnames (with '!') should be completely hidden in sysfs specific code. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: Fix /dev to /sys node name translationStanislav Brabec2015-05-281-1/+19
| | | | | | | | | | | | | | | d0dc6c1 introduced translation of /sys names to /dev names, as required by the kernel linux/drivers/base/core.c: device_get_devnode(). But there are other places of code that use /dev names in /sys. They need reverse translation from '/' to '!'. For example, fdisk -l returns empty list since a22c6eb for device nodes in subdirectories (used e. g. by cciss driver). Introduce yet another helper sysfs_dev_name_to_devname() and use it where appropriate. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* Fix /sys to /dev node name translationStanislav Brabec2015-05-261-0/+18
| | | | | | | | | | | | | | linux/drivers/base/core.c: device_get_devnode() defines a translation of '!' in sysfs nodes to '/' in /dev nodes. The same translation has to be done to properly support device nodes with slash (e. g. device nodes of cciss driver and several other drivers). Introduce new helper sysfs_devname_to_devno() and use it where appropriate. Fixes for example lsblk -f on devices using cciss driver. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* lib/strv: add new functions (from systemd)Karel Zak2015-05-153-0/+59
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: fix string_add_to_idarray() int vs. size_tKarel Zak2015-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | The function uses "int" as argument, but for array size (and index) is better to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk) and "int" in lib/strutils.c then result is unexpected behavior on ppc64. # sfdisk --list -o DEVICE,START,SIZE /dev/sdb Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 32768 bytes Disklabel type: gpt Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539 lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed. The patch cleanup all code to use size_t everywhere. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: support bootbits protection from (p)MBRKarel Zak2015-04-131-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: recognize FAT32 partitions hidden by Acronis softwareJörg Jenderek2015-04-082-0/+2
| | | | | | References: http://www.acronis.de/products/trueimage Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Jörg Jenderek <joerg.jen.der.ek@gmx.net>
* silence compiler warningRainer Gerhards2015-03-101-1/+2
| | | | | This is primarily cosmetic, albeit it also provides an only very slight improvement in compile time error checking.
* build-sys: fix typoKarel Zak2015-03-061-1/+1
|
* lib/timer: use separate file for timersKarel Zak2015-03-063-21/+25
| | | | | | | | It seems that static builds require -lpthread for timer_* functions. It's better to keep it out of our libs (e.g. libmount) to avoid unnecessary dependence. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/monotonic: fix compiler warningsKarel Zak2015-03-051-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: support /usr/lib/os-release tooKarel Zak2015-03-051-1/+3
| | | | | | | | | | | | http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* flock: fix timeout handler pointer usageKarel Zak2015-03-051-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* flock: improve timeout handlingSami Kerola2015-03-053-32/+4Star
| | | | | | | | | | | | Signal ALRM raised by the timer, and the timer only, will be considered as a timeout criteria. Secondly time interval is made to use monotonic clock. Documentation of ITIMER_REAL is unclear whether that time is affected various sources of clock skew, or does it even tick when system is suspended. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: add --enable-usrdir-pathKarel Zak2015-03-031-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The directories /{sbin,bin} are symliks to /usr/{sbin,bin} on many systems. This patch add new ./configure option to remove the non-usr paths from the default $PATH environment variable. The default $PATH is hardcoded in login(1) and can be overwritten by /etc/login.defs. default: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin --enable-usrdir-path: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin This patch does not modify install paths, you still have to care about --{bin,lib}dir configure options. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add USAGE_COLORS_DEFAULTKarel Zak2015-02-251-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: move /dev/log to pathnames.hSami Kerola2015-02-241-0/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rpmatch: use symbolic value when evaluation return codesSami Kerola2015-02-241-0/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: extend parse_switch() to accept more optionsKarel Zak2015-02-241-1/+1
| | | | | | | * allow to specify more 0|1 pairs * allow to specify error message Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: move parse_switch() from setterm(1) to librarySami Kerola2015-02-241-0/+2
| | | | | | | To allow sharing the code with other utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare: Fix --map-root-user to work on new kernelsEric W. Biederman2015-01-091-0/+1
| | | | | | | | | | | | | | | In rare cases droping groups with setgroups(0, NULL) is an operation that can grant a user additional privileges. User namespaces were allwoing that operation to unprivileged users and that had to be fixed. Update unshare --map-root-user to disable the setgroups operation before setting the gid_map. This is needed as after the security fix gid_map is restricted to privileged users unless setgroups has been disabled. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* Merge remote-tracking branch 'sami/2014wk49'Karel Zak2014-12-191-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sami/2014wk49: chfn: make command to obey login.defs CHFN_RESTRICT instructions chfn: remove set_changed_data() and add add_missing() chfn: rename prompt() to ask_new_field() chfn: move new and old finger structs to chfn control struct chfn: clean up parse_argv() chfn: add minimalistic struct chfn_control chfn: simplify parse_passwd() by using strsep() chfn: fix usage() regression chfn: use xasprintf() rather than bunch of strlen() and malloc() calls chfn: rewrite prompt() to use strutils chfn: remove function prototypes lslogins: use hardcoded paths from pathnames.h lslogins: add space to systemd journal header and message lslogins: reject unknown time format arguments lslogins: fix short options lslogins: tell why command failed lslogins: make journald last logs time stamps to honor --time-format lslogins: allow changing password changed and expiration time formats
| * lslogins: use hardcoded paths from pathnames.hSami Kerola2014-12-191-0/+1
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | include/c: define UL_ASAN_BLACKLIST address_sanitizer function attributeSami Kerola2014-12-191-0/+17
| | | | | | | | | | | | | | | | The UL_ASAN_BLACKLIST allows AddressSanitizer to be switched off for functions that cannot be checked. Reference: http://dxr.mozilla.org/mozilla-central/source/mfbt/Attributes.h Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | strutils: fix unsigned integer overflows [AddressSanitizer]Sami Kerola2014-12-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | include/strutils.h:174:10: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long') include/strutils.h:178:6: runtime error: unsigned integer overflow: 18446744073709551615 + 1 cannot be represented in type 'size_t' (aka 'unsigned long') Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]Sami Kerola2014-12-191-1/+3
|/ | | | | | | include/pt-sgi.h:103:7: runtime error: unsigned integer overflow: 0 - 1186450447 cannot be represented in type 'unsigned int' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* login-utils: Enable building util-linux against OpenPAMWill Johansson2014-12-151-1/+5
| | | | | | | | | | OpenPAM is compatible with util-linux, with a few changes, namely using OpenPAM's conversation function, openpam_ttyconv. We check for Linux-PAM by querying for security/pam_misc.h, and OpenPAM by querying for security/openpam.h. Signed-off-by: Will Johansson <will.johansson@gmail.com>
* libmount: add new libmnt_monitor APIKarel Zak2014-12-051-0/+6
| | | | | | | | | | | | It's usually enough to us [e]poll() to monitor kernel mount table, but there is no way how to monitor changes in userspace mount options (e.g. _netdev). The management of these mount options is completely hidden in libmount and /rub/mount/utab is private libmount file. This patch introduces new libmnt_mount API to monitor also userspace mount table. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix bug in cmp_numbers() and partitions sortingKarel Zak2014-12-041-1/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix cfdisk freespace analyzeKarel Zak2014-12-041-0/+8
| | | | | | | | | The problem is how fdisk_partition_cmp_start() compare numbers, the function returns result from "a->start - b->start", unfortunately the numbers are uint64, but function returns "int". Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: add subsystem and hotplug detectionKarel Zak2014-12-021-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/carefulputc: encode also ' and $ in fputs_quoted() outputKarel Zak2014-11-271-0/+2
| | | | | | | | | | | This change is important for commands linked with libsmartcols (e.g. lsblk(1)) to make it more safe for crazy scenarios like eval $(lsblk --fs --pairs /dev/sdb1) where the command returns NAME="value" from filesystem LABELS (etc.) Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move all around clock_gettime() to monotonic.cKarel Zak2014-11-193-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use monotonic time rater than gettimeofdayKarel Zak2014-11-181-0/+3
| | | | | | Based on patch Alexander Samilovskih <alexsamilovskih@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/statfs_magic: use macro rather than type for f_typeKarel Zak2014-11-101-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: remove unnecessary size checkSami Kerola2014-11-071-2/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* switch_root: improve statfs->f_type portabilityKarel Zak2014-11-061-0/+11
| | | | | | | | | __SWORD_TYPE is not available everywhere, for example it's not defined by musl libc. It also seems that __SWORD_TYPE is not used for f_type on some architectures (s390x). Reported-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: replace custom DBG() with include/debug.hKarel Zak2014-11-041-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: improve and cleanupKarel Zak2014-11-031-17/+70
| | | | | | | | | * use ul_debug_ prefix for all routines * support <NAME>_DEBUG=all also for programs without debug mask names (so we can avoid 0xffff mask in man pages) * add function to print debug help Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: properly check for -lrtKarel Zak2014-10-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>