Either works on linux, but kfreebsd build fails
if we don't use the <sys/time.h> include.
According to man gettimeofday the correct include is <sys/time.h>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
The fact that 'syslog tcp/514' does not exist in RFS's, which has lead
to 'syslog-conn 601/tcp' be used in place could be a suprice and should
be told in manual.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Setting whole array to be completely full of nulls cannot be as quick as
making the only significant member of the array when needed.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There is no obvious way to make syslog(3) to print both pid or ppid, so
duplicate the libc syslog() to logger. Making the ppid printing work
using unix socket has side effect of local becoming capable to use both
rfc format output, which is hopefully seen as good thing. The
syslog_local() is format wise one-to-one copy with glibc syslog(3)
format.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
- use allocated buffers to compose the final messages
- initialize static buffers to zero
- remove strlen-after-sprintf
Signed-off-by: Karel Zak <kzak@redhat.com>
This makes the obsolete protocol a little bit more compliant with the
internet standard, but few should care now when we have rfc5424 support,
and rfc3164 feels broken. For example it requires hostname to be not
fully qualified, which is hard to understand, and should make users to
prefer the new protocol.
Reported-by: Frank Thilo <thilo@unix-ag.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705217
CC: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When --file is combined with command line arguments the later has
silently been ignored. This commit makes user to be aware the logger
will not use command line arguments when --file is specified.
Reported-by: "Daniel 'DaB.' Baur" <debian@daniel.baur4.info>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467244
CC: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Users wish to see the message should include also remote messages, not
only the one sent to locally via libc function.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When scripts send several messages they will be easier to group together
when parent process id is printed rather than id of the each logger
process.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Inform about rfc5424 support, how to control what it includes to
submission, and that it is the new default when sending syslog messages
to remote server without specifying protocol.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Add support the more recent syslog protocol and make it default. The
older BSD syslog protocol can still be used with option --rfc3164.
Protocols are meaningful only when messages are sent to remote syslog
server.
Requested-by: Kodiak Firesmith <ksf@sei.cmu.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Add logger_open(), logger_command_line(), logger_stdin(), and
logger_close() functions, and move all remaining option argument
assignments to control structure.
Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When if clause that continues throughout whole function it usually can be
shorten to immediate action, e.g., in this case return on the spot not at
end of the function.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The getlogin(3) is known not to always work, and when that happens it is
reasonable to try determine user of name by looking process owner and
passwd information.
Reference: http://man7.org/linux/man-pages/man3/getlogin.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
It is fair assumption messages an user is asking to be wrote will be
attempted to be wrote as hard as possible.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
"gcc (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]"
issued the following warning:
warning: format ‘%zu’ expects argument of type ‘size_t’, \
but argument 3 has type ‘int’ [-Wformat=]
* misc-utils/mcookie.c (main): Change format from %zu to %d.
RAND_BYTES is an enum, thus of type int.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* 'rename' of git://github.com/kerolasa/lelux-utiliteetit:
tests: add rename(1) return value check
rename: use function pointer to select file or symlink operation
rename: continue despite something failed
tests: add rename(1) checks
tests: use ts_cd everywhere to change direcrory
tests: add function to change directory reliable way
rename: allow renaming in subdirectories
Add separate functions to different functionality, and add a function for
the stuff that is in common for both.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Try to do all file operations even when one or some of them fail, and
use exit value to inform what happen.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier the rename(1) considered path as possible string to be renamed,
could lead to an issue with none existing destination. See below for
demonstration of this issue. After this change all directory elements
are ignored when the match finding happens.
$ cd $(mktemp -d)
$ mkdir aa ab
$ touch a{a,b}/aa
$ rename -v a x */aa
rename: aa/aa: rename to xa/aa failed: No such file or directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The current code does not check size of the columns[] array when add
the next on command line specified column. We check the array size for
"-o <columns>" but not for another options.
Old version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
xargs: lsblk: terminated by signal 11
new version:
$ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
lsblk: too many columns specified, the limit is 83 columns.
Signed-off-by: Karel Zak <kzak@redhat.com>
Using angular brackets around each individual argument, indenting a
continuation line, not using a space before =, improving some wordings,
and the argument of --queue is a value (a piece of data), not a signal.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* 'minor-fixes' of git://github.com/kerolasa/lelux-utiliteetit:
lscpu: avoid double free
libsmartcols: avoid variable dereference after release
libfdisk: do not do the same thing twice in single if statement
whereis: avoid printing uninitialized string
setpriv: avoid alloca() use xmalloc() instead
dmesg: avoid unnecessary variable assignment
fdisk: avoid code duplication
mkfs.cramfs: use defined failure name rather than magic value
fdformat: match variable and print format types
cfdisk: add braces to ensure operation order
lscpu: avoid use of bzero() in favor of memset()
setterm: remove unnecessary variable
cal: remove unnused structure and definition
textual: fix some typos
The Debian package checking tool lintian thinks that the script is
missing Requires on $remote_fs because it pokes at stuff under /usr
and it's probably right.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
The on-demand mode was dropped from libuuid in
commit ea4f8845f0 "libuuid: don't exec uuidd"
You now need systemd (socket activation) to use
uuidd on demand.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
The sigqueue(3) takes two values, signal and sigval. Contents of the
signal can be altered with --signal option argument, so the --queue
argument should be reserved to affect sigval_int.
This is regression fix introduced by commit
9e8dffd5cd.
Reference: http://man7.org/linux/man-pages/man3/sigqueue.3.html
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>