Commit Graph

28 Commits

Author SHA1 Message Date
Benno Schulenberg fc14ceba5e textual: grammarize and harmonize the stat error message
The message "stat failed %s" seems to say that stat() failed to
do something, or failed to pass a test, but of course it means
that the statting of something failed.  So say so.  Also make
two very similar messages equal to this one.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 11:27:10 +01:00
Karel Zak 912a7077b2 utmpdump: don't pass parameter of type "struct utmp" by value [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-29 11:40:47 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
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>
2015-01-06 11:27:38 +01:00
Ruediger Meier 18df1cc77c utmpdump: fix localtime() error handling
If current TZ has no representation of a given time_t then localtime()
would return NULL and break the next strftime().

In practice this happens very likely on systems with 64bit time_t when
parsing broken binary data. Seen on aarch64 (and probably s390) using
our (incompatible) test wtmp data.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-06-11 23:06:32 +02:00
Karel Zak 85dd024d84 utmpdump: make analyzers happy
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-01 17:11:25 +02:00
Sami Kerola ee508c153f utmpdump: make IPv6 addresses work
(unless bug[s]) This change is backwards compatibile.  Earlier binary to
text dumps can be converted back to binary, or otherway around.

The only thing that will not work are IPv6 addresses that possible
earlier conversion had broke.  Such conversions resulted with random IPv4
in place of IPv6 address in text format, and original information is gone
forever.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:10 +01:00
Sami Kerola cfa7fe890b last, utmpdump, agetty, wall, write: avoid compatibility hacks
In include/bits/utmp.h the ut_user and ut_time macros are marked with
comment they are backwards compatibility hacks.  It is probably best to
avoid use of these macros where ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:10 +01:00
Sami Kerola ad20f0d883 utmpdump: assigned values are never read [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:07 +02:00
Sami Kerola 930954d87a utmpdump: add option to write to a file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:25:58 +02:00
Karel Zak 48f2fdbf89 utmpdump: fix compiler warning [-Wunused-result]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:46:49 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola 400bc941fc utmpdump: use help and version output macros
Done to reduce translation project work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola 4e7e68ca6f utmpdump: remove unused variable
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:21 +02:00
Karel Zak faebdd91ba utmpdump: cleanup file descriptor usage
- don't support --follow for stdin at all
 - inotify based implementation closes the file, so don't close it in
   main() again

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-10 11:25:11 +02:00
Sami Kerola 5ec1ad1348 utmpdump: encourage users not to follow stdin
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-10 11:01:29 +02:00
Sami Kerola 7346f2b61c utmpdump: use inotify to when following file
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-10 10:59:58 +02:00
Sami Kerola e31926b443 utmpdump: fixes based on static analysis [cppcheck]
[utmpdump.c:82]: (style) The function 'unspace' is never used
[utmpdump.c:131]: (style) The scope of the variable 't' can be reduced
[utmpdump.c:167]: (warning) scanf without field width limits can crash with huge input data

[kzak@redhat.com: - don't use scanf field width limits for integers]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-10 08:56:22 +02:00
Sami Kerola cd903a0eba utmpdump: white space fix
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-09 18:04:37 +02:00
Bernhard Voelker 4810de912a utmpdump: document optional filename argument
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-07-09 17:11:00 +02:00
Karel Zak 34f4d96163 utmpdump: use xalloc.h, minor coding style changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 17:34:12 +02:00
Karel Zak c8a6af07e7 utmpdump: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 17:27:40 +02:00
Karel Zak 9e15c93d76 utmpdump: add long options
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 17:22:42 +02:00
Karel Zak 704bd903ec utmpdump: use err.h stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 17:09:51 +02:00
Karel Zak 23031b9904 utmpdump: add NLS and closestream support
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:59:32 +02:00
Karel Zak a9eee87090 utmpdump: remove dead code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:56:04 +02:00
Karel Zak b89fc9151f utmpdump: remove libc5 support
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:52:30 +02:00
Karel Zak fa9baa80e8 utmpdump: cleanup comments, funcs definition lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:43:37 +02:00
Karel Zak 78d5ceacb1 utmpdump: new command, merge from sysvinit
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-29 16:34:46 +02:00