Commit Graph

6640 Commits

Author SHA1 Message Date
Karel Zak e781a04fec last: add link to util-linux to last.1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 10:26:28 +02:00
Karel Zak 77079432d7 last: coding style clean up
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 10:22:50 +02:00
Karel Zak a9f789e518 last: use xalloc.h, err.h, nls.h and EXIT_ macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 14:10:42 +02:00
Karel Zak 4c7dfea7a4 last: consolidate btmp/wtmp file paths
.. so share the paths with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 13:42:25 +02:00
Karel Zak 293e0c90e4 last: add long options, improve usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 13:39:11 +02:00
Karel Zak ec01e9d048 build-sys: fix last stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:59:52 +02:00
Karel Zak ad869f9ec5 build-sys: improbe UL_CONFLICT_BUILD macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:59:22 +02:00
Karel Zak 4d1d1233f4 last: clean up the begin of the file
.. and improve last(1) stuff in configure script.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:26:03 +02:00
Ondrej Oprala ce60272039 last: merge sysvinit last/lastb
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-12 12:07:52 +02:00
Karel Zak 6f96420666 agetty: -L accepts optional argument
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-06 15:39:11 +02:00
Karel Zak 3cb2413b02 losetup: use loop-control to explicitly ask for device
Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example

  losetup -f foo.img

Unfortunately, losetup(8) allows to ask for specified device

  losetup /dev/loop100 foo.img

and in this case we assume that the device already exists in the
system. This is incorrect, we should be able to use loop-control
LOOP_CTL_ADD ioctl to ask for the specified device.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-06 11:04:35 +02:00
Karel Zak 777519226d blkdiscard: use fstat() rather than stat() [coverity scan]
Calling function "open(char const *, int, ...)" that uses "path" after
 a check function. This can cause a time-of-check, time-of-use race
 condition.

.. well, in blkdiscard context it's mostly cosmetic change.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-06 10:29:04 +02:00
Karel Zak 21ce3f3a4e losetup: fix loop device name usage
The code is not paranoid enough, loopcxt_set_device() only set the
device name to loopdev struct, but it does not check if the device
really exists.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-05 16:08:34 +02:00
Karel Zak 68c41a5f5f libmount: be robust when work with loopdev backing file paths
It's usually unnecessary as we compare devno and ino, but let's
use absolute paths for situations when it's necessary to compare
paths as strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-05 15:35:39 +02:00
Karel Zak 6d62bc0f9b losetup: make -j <path> more robust
It's usually unnecessary as we compare devno and ino, but let's
use absolute paths for situations when it's necessary to compare
paths as strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-05 15:35:26 +02:00
Karel Zak 3f420a49dd libmount: canonicalize for conversion from loopdev backing file
# mount foo.img /mnt
  # umount foo.img
  umount: foo.img: not mounted

The loopdev code (and sysfs backing_file) uses absolute paths, but
libmount does not canonicalize the path before lookup for the backing file.

References: https://bugzilla.redhat.com/show_bug.cgi?id=950497
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-05 13:58:01 +02:00
Sami Kerola 1beb933efd cal: set statically defined data read-only
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-05 10:47:51 +02:00
Sami Kerola 2587c5937c more: make output redirection more efficient
Especially with large inputs the change improves performance
considerably.

old> time more /boot/vmlinuz >/dev/null
real    0m0.224s

new> more /boot/vmlinuz >/dev/null
real    0m0.009s

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-05 10:47:47 +02:00
Sami Kerola d2b7bc74d9 column: use variable lenght printf field width to wprint blanks
This makes program to run a little faster.  My test input show about 20%
speed improvement.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-05 10:47:42 +02:00
Ondrej Oprala d58b315704 libmount: fix typos
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-08-05 10:47:02 +02:00
Karel Zak 418cb4b3bb more: guarantee space for multibyte
.. to make the code more robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-01 17:03:27 +02:00
Karel Zak c36407293d more: check for buffer size when write multibyte char
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-01 16:00:21 +02:00
Karel Zak f1477c4b74 mkswap: add note about swap header limit to the man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-01 15:00:59 +02:00
Sami Kerola 4b4eb34004 rev: use string printing rather than character output
Fliping a string in memory, and printing it with multibyte output
function makes the command about 1/3 quicker.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:39 +02:00
Sami Kerola c8498f2fad build-sys: use backticks rather than $() for commands in configure
The configure had both backticks and $() in use.  These command
susbstitutions are mutually interchangeable, so one should pick only one
form.  In this case backticks were favored because they are known with
greater range of shells, making the backticks to be more portable.

References: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Shell-Substitutions.html#index-g_t_0024_0028_0040var_007bcommands_007d_0029-1632
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:38 +02:00
Sami Kerola 3013eb9dc0 build-sys: prefer AS_IF rather than shell 'if'
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:36 +02:00
Sami Kerola 9f57e6e849 build-sys: prefer AS_CASE rather than shell 'case'
References: http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Builtins.html#case
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:30 +02:00
Sami Kerola 034d378b23 build-sys: use m4 quoting consistently
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:28 +02:00
Sami Kerola f29a3d1868 setarch: prefer preprocessor rather than autotools check
It seems to be pointless to spend time in ./configure phase when
preprocessor has to perform #ifndef check anyway.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:26 +02:00
Sami Kerola 145a3ca364 lscpu: fix shadow declaration [smatch scan]
sys-utils/lscpu.c:572:22: warning: symbol 'fd' shadows an earlier one

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:24 +02:00
Karel Zak 1ef2db5a56 more: fix buffer overflow
The bug has been probably introduced by commit
1ac300932d.

Reported-by: "Dr. David Alan Gilbert" <dave@treblig.org>
References: https://bugzilla.novell.com/show_bug.cgi?id=829720
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-01 12:58:22 +02:00
Daniel Kahn Gillmor 0dde19974b setsid: add an option to wait child return value
This change proposed in util-linux maillist by Damien Wyart in behalf of
Daniel Kahn Gillmor.  Sami Kerola changed the patch to use option rather
than makign the default behavior of the command to change.

Reported-by: Damien Wyart <damien.wyart@gmail.com>
Reference: http://markmail.org/message/2z6qh5auk7wjie3l
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495881
CC: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 11:31:47 +02:00
Ondrej Oprala 7b1333fa6a libmount: add missing declarations to libmount.h.in and documentation
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-08-01 11:23:02 +02:00
Ondrej Oprala 3035ba93af libmount: change tailing to trailing in *_tailing_comments functions
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-08-01 11:21:47 +02:00
Karel Zak 5042cdcf77 dmesg: don't use pager for --follow
References: https://bugzilla.redhat.com/show_bug.cgi?id=984666
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-29 13:51:35 +02:00
Karel Zak 01307ecf1b losetup: set errno for misaligned offsets
References: https://bugs.archlinux.org/task/36189
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-19 17:15:44 +02:00
Karel Zak 5d3da4a24d mount: update xfs docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-16 11:23:51 +02:00
Karel Zak 8cf4152c42 hwclock: remove references to adjtimex from man page
The adjtimex is optional on many distros.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-15 18:04:00 +02:00
Karel Zak 4d9b5956cf sfdisk: don't use word 'disk'.
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-15 12:14:10 +02:00
Karel Zak 57a24292ff uuidd: add missing initializer [clang-analyzer]
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-09 14:45:41 +02:00
Karel Zak cfa44747f3 libmount: fix memory leak [clang-analyzer]
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-09 14:39:49 +02:00
Karel Zak 8bd6450375 sulogin: fix compiler warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-09 14:32:05 +02:00
Sami Kerola b9f3d0c0ff more: use variable lenght printf field width to print blanks
This makes program to run a little faster.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:26:10 +02:00
Sami Kerola c630db891a column: dereference of null pointer [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:26:06 +02:00
Sami Kerola 67519cdd8f ul: use string printing function
Use of for loop and printing a string character by character is slower
than to print whole string with single function.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:55 +02:00
Sami Kerola aa971f7d58 ul: use correct types
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:36 +02:00
Sami Kerola 3797cf255b agetty: fix memory leak [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:15 +02:00
Sami Kerola 21c4058d92 sulogin: fix memory leak [clang-analyzer]
And make code a little bit more robust.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:13 +02:00
Sami Kerola c1ed5e513c sfdisk: assigned value is never read [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:12 +02:00
Sami Kerola 467ca0b214 chfn: assigned value is never read [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:11 +02:00