Commit Graph

10195 Commits

Author SHA1 Message Date
Ruediger Meier beabee7c67 libsmartcols: fix uninitialized variable
This got broken in 2a750b4c.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:04:54 +01:00
Ruediger Meier 262c94c2c7 fdisk: fix warning, incompatible pointer types passing 'uint64_t *'
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:04:48 +01:00
Ruediger Meier 4199e9891e logger: use SCM_CREDENTIALS on LINUX only
This is a build fix of FreeBSD and OSX. Basically we revert
the following commit for non-linux systems:
27a9eb53 "use --id as local socket credentials"

Note I could also compile it like this:

  #ifdef HAVE_SYS_UCRED_H
  # define _WANT_UCRED
  # include <sys/param.h>
  # include <sys/ucred.h>
  # define SCM_CREDENTIALS SCM_CREDS
  #endif

  [...]
  #ifdef _linux_
  cred->pid = ctl->pid;
  #endif
  [...]

... but don't know how to test whether it does what it
should.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-26 03:29:41 +01:00
Karel Zak b64dc52a53 Merge branch 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux
* 'ldadd-cflags-warnings' of https://github.com/rudimeier/util-linux:
  build-sys: disable unused parameter warnings for some test progs
  misc: fix compiler warnungs (unsigned/signed)
  misc: fix warnings "unused parameter" [-Wunused-parameter]
  libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]
  tests: fix compiler warnings [-Wmissing-prototypes]
  libfdisk: fix compiler warnings [-Wmissing-prototypes]
  libfdisk: fix missing symbol
  libblkid: fix compiler warnings [-Wmissing-prototypes]
  libmount: add mnt_fs_set_priority()
  build-sys: always add AM_CFLAGS
  build-sys: always use global LDADD
2016-02-24 13:51:10 +01:00
Karel Zak 1c3ed5bf17 libsmartcols: fix stupid typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-24 13:42:28 +01:00
Karel Zak 249fc8fe89 unshare: add example for persistent mount namespace
References: https://github.com/karelzak/util-linux/issues/289
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-24 13:28:19 +01:00
Ruediger Meier a03eac5294 chrt: restore removed ifdef SCHED_RESET_ON_FORK
They got lost in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-24 12:46:20 +01:00
Ruediger Meier 59e4a3827b chrt: fix case SCHED_RR
Looks like the logic was mistakenly changed in acde3a05.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-24 12:46:20 +01:00
Karel Zak cbe3e49535 libsmartcols: fix relative column width for maxout
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-24 12:34:37 +01:00
Karel Zak c1d185c77b findmnt: use scols_table_print_range() for --poll
This change fixes problem with duplicate header line.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-24 12:04:24 +01:00
Karel Zak 7db029e54a logger: always update header when writing stdin line
Addresses: http://bugs.debian.org/798239
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-24 10:40:08 +01:00
Ruediger Meier 2013b33f40 build-sys: disable unused parameter warnings for some test progs
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:20:22 +01:00
Ruediger Meier b9710f1f08 misc: fix compiler warnungs (unsigned/signed)
These ones should be fixed:
libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:27 +01:00
Ruediger Meier 71177ab8f9 misc: fix warnings "unused parameter" [-Wunused-parameter]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:24 +01:00
Ruediger Meier 63a7065b2c libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:21 +01:00
Ruediger Meier 5fde1d9f06 tests: fix compiler warnings [-Wmissing-prototypes]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:09 +01:00
Ruediger Meier 74272f00e1 libfdisk: fix compiler warnings [-Wmissing-prototypes]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:27:34 +01:00
Ruediger Meier f3aca7ab21 libfdisk: fix missing symbol
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:25:41 +01:00
Ruediger Meier b55b9fccf6 libblkid: fix compiler warnings [-Wmissing-prototypes]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:25:07 +01:00
Ruediger Meier 48df5980b4 libmount: add mnt_fs_set_priority()
Looks like it got lost in ce4dd666.

Compiler warning discoverd this issue:
libmount/src/fs.c:1171:5: warning: no previous prototype for 'mnt_fs_set_priority' [-Wmissing-prototypes]
 int mnt_fs_set_priority(struct libmnt_fs *fs, int prio)
     ^

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:19:49 +01:00
Ruediger Meier b0b54cc582 build-sys: always add AM_CFLAGS
We were missing our nice compliler warnings for many programs
and libs. See next commits how many trivial and non-trival
warnings have to be fixed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:17:29 +01:00
Ruediger Meier b201f1d86c build-sys: always use global LDADD
This was a major showstopper when building on a system where
LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test
programs which wouldn't need LDADD ... never mind.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:16:58 +01:00
Karel Zak 334e5eba9e libsmartcols: fix scols_table_print_range() to print header
References: https://github.com/karelzak/util-linux/issues/287
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-22 10:43:25 +01:00
Karel Zak 96592b4902 Merge branch 'scols_table_print_range_to_string' of https://github.com/ignatenkobrain/util-linux 2016-02-22 10:37:41 +01:00
Karel Zak 80d00db17e Merge branch 'errno-strutils' of https://github.com/rudimeier/util-linux 2016-02-22 09:50:57 +01:00
Hushan Jia e0bbe3d6ff ipcs: show gid instead of uid
ipcs -i incorrectly used uid where it should be gid

Signed-off-by: Hushan Jia <hushan.jia@gmail.com>
2016-02-22 09:50:22 +01:00
Romain Naour 092bc0edaa vipw: Remove pre-ANSI compiler support
__P() is used for compatibility with old K&R C compilers. With
ANSI C this macro has no effect.

This fixes a compilation error with musl libc because of undeclared
__P.

Ref:
https://lists.samba.org/archive/samba-technical/2015-June/108042.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2016-02-22 09:50:22 +01:00
Romain Naour 7944a03cef build-sys: fix typo
When timer_create is available have_timer must be
set to "yes". But instead have_time is used.

Replace have_time by have_timer.

Fixes:
http://autobuild.buildroot.net/results/993/9935cd0522d4f978ba2e788a690f66790686b76b

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2016-02-22 09:50:22 +01:00
Igor Gnatenko cfa185721e libsmartcols: implement scols_table_print_range_to_string
Reference: https://github.com/karelzak/util-linux/issues/283
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-02-21 21:13:50 +01:00
Ruediger Meier 423ef37592 tests: add logger tests "id _numbers_ with spaces"
Leading spaces are allowed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-21 18:10:09 +01:00
Ruediger Meier f643d3349e lib/strutils: parse_size(), sync errno and return value
Maybe strtosize_or_err() is the only function which uses
this errno (wrongly). But it doesnt hurt to maintain rc
as well as errno.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-21 18:10:00 +01:00
Ruediger Meier ca8eff2ade lib/strutils: add more ERANGE messages
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-21 18:09:28 +01:00
Ruediger Meier 73b9e094a8 lib/strutils: fix errno usage in strtoint functions
Don't use undefined errno:
$ ./logger --no-act -t "wtf" --id="" message
logger: failed to parse id: '': No such file or directory

Don't print useless EINVAL message but ERANGE only:
$ ./logger --no-act -t "wtf" --id="XX" message
logger: failed to parse id: 'XX': Invalid argument

Note the ERANGE-only improvement does not change anything on
Linux/c99 as strtoul(3) only set ERANGE there.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-21 18:08:26 +01:00
Karel Zak 12ca9cb1f5 libsmartcols: add sample-scols-continuous
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 16:47:38 +01:00
Karel Zak 2981e0fd0e libsmartcols: support continuous printing
This patch allows to disable line-breaks. This feature is usable when
you want to re-print the same line more than once -- move terminal
cursor to the begin of the line and print again and again (aka
progress bar).

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 16:43:28 +01:00
Karel Zak 2a750b4c4e libsmartcols: add scols_table_print_range()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 14:43:06 +01:00
Karel Zak a8b122f229 hwclock: use labs() for long
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-19 11:38:04 +01:00
Karel Zak 45c9a3d27f Merge branch 'port-osx' of https://github.com/rudimeier/util-linux
* 'port-osx' of https://github.com/rudimeier/util-linux:
  include: fix sys/sysinfo.h
  libblkid: don't include endian.h
  lib: fix ismounted includes for FreeBSD
  lib: remove unused variable
  lsns: use xcalloc()
  include: remove unused mntent.h
  include: check for sys/sysmacros.h
  lib: define LOGIN_NAME_MAX fallback
  include: provide MAP_ANONYMOUS on OSX
  lib: rename strmode() and setmode()
  tests: fix ts_option helpers
  build-sys: fix [g]libtoolize version for OSX
  build-sys: check linker support for version scripts
  build-sys: portable usage of find command
  travis: minor cleanup
2016-02-19 11:30:53 +01:00
Ruediger Meier 440d1db7b0 include: fix sys/sysinfo.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:38 +01:00
Ruediger Meier a8d4e707e2 libblkid: don't include endian.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:35 +01:00
Ruediger Meier ac1c53e451 lib: fix ismounted includes for FreeBSD
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:32 +01:00
Ruediger Meier b9071bf5dc lib: remove unused variable
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:29 +01:00
Ruediger Meier 9d3d66dfaa lsns: use xcalloc()
... found by tools/checkxalloc.sh

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:26 +01:00
Ruediger Meier f3e0213aa4 include: remove unused mntent.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:23 +01:00
Ruediger Meier 66daee0765 include: check for sys/sysmacros.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:17 +01:00
Ruediger Meier 06c8aec38c lib: define LOGIN_NAME_MAX fallback
LOGIN_NAME_MAX was unused in misc-utils/namei.c since 04a5cb58.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:14 +01:00
Ruediger Meier 40733239a7 include: provide MAP_ANONYMOUS on OSX
Hope there are no side effect when defining _DARWIN_C_SOURCE
globally.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:05 +01:00
Karel Zak eae665f24b libfdisk: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-18 14:23:37 +01:00
Karel Zak 97ffbd43d2 cfdisk: wipe device if create a new label
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-18 12:58:12 +01:00
Karel Zak 15b5e942f2 sfdisk: add --wipe
This patch changes sfdisk behavior and it wipes foreign signatures
from the device to avoid collisions. The wipe functionality is
automatically enabled in the interactive mode only (user is always
warned about it), otherwise it's possible to control all by --wipe
<auto|never|always>.

The program does not change behavior when executed in scripts (echo
<something> | sfdisk), the option "--wipe=always" is required to enable
in this case.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-18 12:58:12 +01:00