summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* build: fix some compiler warningsRuediger Meier2014-05-301-1/+4
| | | | | | | | | | | | Most of them catched on 32bit gcc and icc. disk-utils/fsck.cramfs.c: printf format type lib/boottime.c: unused variables misc-utils/cal.c: set but never used sys-utils/losetup.c: set but never used sys-utils/lscpu-dmi.c: defined but not used sys-utils/switch_root.c: comparison between signed and unsigned tests/helpers/test_sysinfo.c: printf format type
* losetup: don't clear FD at EBUSY error in loopcxt_setup_device()Stanislav Brabec2014-05-281-1/+1
| | | | | | | | | loopback lib clears the existing FD unconditionally at error in loopcxt_setup_device(). This is done even after EBUSY, thus the second call actually clears the previous setup wrongly. Author: Takashi Iwai <tiwai@suse.de> Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* lib/canonicalize: make DM canonicalization more robustKarel Zak2014-05-201-15/+30
| | | | | | | | The current code cares about filenames, but it's too fragile, we have to check the path is really path to the block device. Addresses: https://github.com/karelzak/util-linux/issues/83 Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: also add readutmp.cOndrej Oprala2014-05-151-0/+76
|
* lslogins: add functionalityOndrej Oprala2014-05-151-1/+2
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* losetup: fix -f on systems without /dev/loop-controlKarel Zak2014-05-141-14/+35
| | | | | Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add to the man page hint about $HOME stuffKarel Zak2014-05-131-1/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: update man pageKarel Zak2014-05-131-11/+140
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: support schemes customizationKarel Zak2014-05-131-83/+419
| | | | | | | | | | | | | | | | * parse terminal-colors.d/*.scheme files, expected format is <name> <color-sequence> * supported color sequences: - color name (e.g. "red") - dir_colors compatible xx;yy (e.g. 01;31) where the sequence may contains control chars like \e \a ..etc. * scheme is parsed on demand Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: allow to temporary disable colorsKarel Zak2014-05-131-30/+75
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add support for @term and /home/kzakKarel Zak2014-05-131-31/+268
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/boottime: add a new fileKarel Zak2014-05-061-0/+34
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: remove get_boot_time from libcommonKarel Zak2014-05-061-26/+0Star
| | | | | | | | clock_gettime() needs -lrt, so let's keep this stuff outside libcommon.la Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/terminal-colors.d.5: Improve the typesetting of the manualBjarni Ingi Gislason2014-05-061-9/+9
| | | | | | | | | | Remove '\&' in front of a full stop (.), when it does not start or end a string Adjust space between sentences to two space characters (or begin each sentence on a new line). Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* lib/colors: change an include to a local oneBenno Schulenberg2014-05-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* lib/pager: use names when referring to standard file descriptorsSami Kerola2014-05-061-9/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/timeutils: fix memory leakSami Kerola2014-05-061-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: move get_boot_time() to lib/timeutilsSami Kerola2014-05-041-0/+29
| | | | | | In future the last(1) will use get_boot_time() as well. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/procutils: notice setuid() process ownership changesSami Kerola2014-04-261-4/+5
| | | | | | | | | Earlier the owner of a process was determined by owner of the /proc/<pid>/stat file. When changes user ID privileges with setuid() the stat file ownership is not updated, that resulted kill(1) to consider such processes where running using same uid as the present process. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/procutils: reset errno before strtol() callSami Kerola2014-04-261-1/+2
| | | | | | | | When going through /proc the last entry made readdir() to alter errno, which made the strtol() to think something went wrong, resulting kill(1) tests to fail when running in --parallel mode. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/mbalign: report also size in bytesKarel Zak2014-04-151-10/+30
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: split mbs_safe_encode()Karel Zak2014-04-151-12/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: rewrite test code to tree(1)-like utilKarel Zak2014-04-081-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt.c: Goodbye!Ondrej Oprala2014-04-032-998/+0Star
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* mcookie: use lib/randutilsSami Kerola2014-03-261-0/+22
| | | | | | | | | The mcookie should reuse existing code, and there is definitely no need to prefer /dev/random for this utility. See reference for explanation about later statement. References: http://www.2uo.de/myths-about-urandom/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: care about colors only on tty()Karel Zak2014-03-121-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: fix parse_size() return codeKarel Zak2014-03-111-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: fix colors testKarel Zak2014-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: keep track about output orderKarel Zak2014-03-111-1/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add tt_line_get_userdata()Karel Zak2014-03-111-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: support dec.points in parse_size()Karel Zak2014-03-111-2/+43
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: use proper return codes in parse_size()Karel Zak2014-03-111-9/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbalign: add mbs_safe_width() from tt.cKarel Zak2014-03-112-136/+136
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/tt: add function to convert table to stringKarel Zak2014-03-111-0/+26
| | | | | | | Note that open_memstream() is POSIX-1.2008, so it's possible than not all libc have already implemented this function. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add reduce term width functionalityKarel Zak2014-03-111-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add TT_FL_MAX to fill screenKarel Zak2014-03-111-2/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add tb_get_nlines()Karel Zak2014-03-111-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: don't hardcode stdout as outputKarel Zak2014-03-111-13/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: support <name>.enable tooKarel Zak2014-03-112-18/+38
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add info to man pages, add terminal-colors.d.5Karel Zak2014-03-112-0/+27
| | | | | Co-Author: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: check for /etc/terminal-colors.d/[util].disableOndrej Oprala2014-03-111-4/+25
| | | | | | | | [kzak@redhat.com: - move paths to pathnames.h, - use static path buffer] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: make dirent d_type usage more robustKarel Zak2014-03-041-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/color: add colorscheme parserKarel Zak2014-02-101-2/+47
|
* losetup: wait for udevKarel Zak2014-01-241-5/+18
| | | | | | | | | | | | | On system with /dev/lop-control the udevd creates /dev/loopN nodes. It seems better to wait a moment after unsuccessful open(/dev/loopN) and try it to open again. The problem is pretty visible on systems where udevd also modifies permission for loopN devices, then open() fails with EACCES when losetup executed by non-root user (but user who is in "disk" group). Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1045432 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: fix scanf format string [coverity scan]Karel Zak2014-01-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: add path_strdup()Karel Zak2014-01-061-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: standardize some "cannot read" and "seek failed" error messagesBenno Schulenberg2013-10-091-4/+4
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* losetup: don't require 512-byte aligned offsetsKarel Zak2013-10-011-0/+6
| | | | | | | | | | | | | | | | Kernel aligns the device size, but the offset where the device starts is not required to be aligned. # losetup --offset 32 -f file.img is just fine, the final size of the look device will be (in sectors) (backing_file_size - offset) >> 9 so we have to do the same in userspace when we check for successful set capacity ioctl. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add -L to colorize outputKarel Zak2013-09-161-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: add TT_FL_FREEDATAKarel Zak2013-09-161-1/+9
| | | | | | ... to call free() for line data. Signed-off-by: Karel Zak <kzak@redhat.com>