Commit Graph

4021 Commits

Author SHA1 Message Date
Sami Kerola 43b53f57c1 islocal: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00
Sami Kerola 0a065b7ae6 chsh: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00
Sami Kerola 3ca1029905 chfn: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00
Sami Kerola e55b7a8f2f chfn, setpwnam: let config.h be in control of extensions in use
The autotools will set _GNU_SOURCE which removes necessity to have
any _*_SOURCE definition in *.c files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00
Sami Kerola 57b35f3ba7 chfn, chsh: new file pamfail.h for error printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:57:39 +01:00
Sami Kerola 7299ca031d chsh: build bug: do not override config.h definition
The ONLY_LISTED_SHELLS is defined by --disable-chsh-only-listed
configuration option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:52:50 +01:00
Sami Kerola 8187b555df chfn, chsh, setpwnam: get true/false from stdbool.h
Requires C99, which should not be a problem.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:50:17 +01:00
Sami Kerola 0effd19e00 login: add version printing option
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola e947e27360 newgrp: add version and help options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola 92ba78e24d vipw: stop printing non-sense version string
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola 81c8a46f57 vipw: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola 8fed34e5a1 chsh: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola fbff9d7996 chsh: align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Sami Kerola b9364124f8 chfn: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:35:26 +01:00
Sami Kerola 85b6104da5 chfn: align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:20:11 +01:00
Karel Zak f75b8e5cdf fallocate: clean up fallbacks for FALLOC_FL_* flags
Reported-by: Voelker, Bernhard <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-23 15:19:20 +01:00
Karel Zak 13b3e7796b tests: add mkfs.carmfs test for small FS with duplicate files
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-23 14:10:56 +01:00
Arnaud Mouiche 8b472bfa73 small bug in mkfs.cramfs + patch
mkfs.cramfs on version v2.17.2 has a small bug when dealing with very small
filesystems.  look at upstream code on git, and the issue is still here.
ex:

         $ cd /tmp
         $ mkdir content
         $ echo hello > content/a
         $ echo hello > content/b
         $ mkfs.cramfs content content.cramfs
         not enough space allocated for ROM image (4090 allocated, 4096 used)

Here is a patch for fixing (simply rounding to page size AFTER eleminating
doubles).

Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-23 13:29:32 +01:00
Cong Wang 411fd3c27a fallocate: add FALLOC_FL_PUNCH_HOLE support
Recent Linux kernel supports FALLOC_FL_PUNCH_HOLE in fallocate(2).
This patch adds FALLOC_FL_PUNCH_HOLE support to fallocate utility,
by introducing a new option -p|--punch-hole.

[kzak@redhat.com: - fix merge conflict in fallocate.1]

Cc: Karel Zak <kzak@redhat.com>
Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-23 13:12:48 +01:00
Jim Meyering 1023db5015 prlimit: s/amount/number/ 2011-11-23 12:52:36 +01:00
Bernhard Voelker 53e1f461f9 prlimit: add support for executing a command
prlimit.c: Alternatively to applying the limits to an existing process via the
--pid option, allow a command to be executed. Adapted usage() accordingly.

prlimit.1: mention new syntax.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2011-11-23 12:11:46 +01:00
Francesco Cosoleto 0459a7b389 libblkid: fix mac partition detection
This fixes the buffer length passed to blkid_probe_get_buffer() calls,
and the block size byte order (on little-endian systems).

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-22 16:58:25 +01:00
Masatake YAMATO d8ebc83ff2 mount: enable fstab.d
This patch makes mount command read fstab.d/*.fstab if the command
is built with --enable-libmount-mount.

[kzak@redhat.com: - add some info to fstab.5 and mount.8 man pages
                  - use error callback for tab parser]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-22 15:43:20 +01:00
Karel Zak eb742a1f66 flock: use O_RDWR as fallback if O_RDONLY returns EIO
The commit 75aaee08f0 introduces
regression:

     $ echo '#!/bin/sh' > test.sh
     $ chmod a+rx test.sh
     $ flock -eon ./test.sh ./test.sh
     flock: ./test.sh: Text file busy

The lock file cannot be opened in read-write mode by default, because
then we cannot use flock(1) to lock executable files.

The read-write mode for lock files is necessary on NFSv4 where
flock(2) is emulated by by fcntl() -- this situation is possible to
detect by flock(2) EIO error.

This patch reverts the default to O_RDONLY and use O_RDWR only if EIO
error is detected.

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-21 17:26:41 +01:00
Karel Zak bc3ae4c6fc flock: timer code refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-21 15:02:56 +01:00
Karel Zak a40f08ef79 login: fix compiler warning [-Wreturn-type]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-18 13:19:21 +01:00
Karel Zak 5018dc3da5 build-sys: add missing BUILD_PRLIMIT
Reported-by: Thorsten Kukuk <kukuk@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-18 13:12:18 +01:00
Karel Zak 34f7ea15c1 login: improve pam_setcred() usage
Reported-by: Thorsten Kukuk <kukuk@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-18 12:54:30 +01:00
Jim Meyering 26ae00a72b column: avoid memory overrun and/or use of uninitialized buffer
* text-utils/column.c (maketbl): Use the right starting point
and the right length when zeroing new memory after xrealloc.
2011-11-16 23:51:33 +01:00
Karel Zak 8b6e450388 prlimit: don't share pointer for old and new in prlimit(2)
This patch makes the code more robust. We should not share the same
pointer for old and new arguments for prlimit(2) syscall.

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 13:30:05 +01:00
Karel Zak 94c0166257 prlimit: avoid segfault due to array-out-of-bounds error
Example:
$ prlimit -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l -l
RESOURCE DESCRIPTION                         SOFT   HARD UNITS
MEMLOCK  max locked-in-memory address space 65536 262144 bytes
MEMLOCK  max locked-in-memory address space 65536 262144 bytes
...
Segmentation fault

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 13:21:40 +01:00
Bernhard Voelker f7fe8a9ba0 prlimit: fix typo in man page, option --verbose
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2011-11-16 12:06:59 +01:00
Karel Zak 2f0948b18d prlimit: replace lims[i] with pointer
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 12:04:52 +01:00
Bernhard Voelker 044bc8de2d prlimit: fix case when PID is given later
# prlimit --nofile=:4000 --pid $$

When the PID is given later than a partially given limit, then prlimit
used the current PID for getting the missing part (hard, soft) of the
limit.

Factored out the retrieval of the unknown limit from parse_prlim() to
new get_unknown_hardsoft() which is to be called by do_prlimit() based
on the struct prlimit member 'modify' set by add_prlim().

[kzak@redhat.com: - use prlimit->mofify as mask
                  - add soft vs. hard limit check from another
                    Bernhard's patch]

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 11:55:43 +01:00
Karel Zak f88e44be57 prlimit: fix error message
- differentiate between set and get operations
 - add limit name to the error message
 - remove PID from the message (whole util works always with only one
   PID, so this info is superfluous)

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-16 10:54:07 +01:00
Bernhard Voelker 8f71d37bc5 prlimit: show all limits if called without options
Fix option parsing: prlimit ran into usage() if called
without arguments which should only be done for surplus
arguments. Instead, it should display all limits.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2011-11-16 10:24:28 +01:00
Karel Zak f126cd4694 wipefs: add -t <list> option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-15 15:19:28 +01:00
Karel Zak 1208915521 lib,match: split match_fstype() from libmount
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-15 15:17:19 +01:00
Karel Zak e13fe2063c libblkid: export PTMAGIC also if only PTTYPE requested
Reported-by: David Zeuthen <davidz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-15 12:49:31 +01:00
Francesco Cosoleto 47104bae89 fdisk: split delete_partition() off from dos_delete_partition()
This accidentally fixes a mistake printing the "Partition n is deleted"
message as the 'i' variable get decremented or incremented in case of
logical partitions.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 15:07:28 +01:00
Francesco Cosoleto 798d621c3b fdisk: avoid segfault validating a sgi label (boot/swap not set)
swap_part or boot_part can be set to -1 when they don't exist.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 15:07:18 +01:00
Francesco Cosoleto a8c6fddb2e fdisk: use ngettext() in str_units() for plural forms
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 15:07:13 +01:00
Harald Hoyer 944de78b5d switch_root: umount mount points we cannot move with MNT_DETACH
If a mount point cannot be moved to the new root, umount it with
MNT_DETACH, so that it is lazy umounted and does not show up in
/proc/mounts anymore.

[kzak@redhat.com: - add MNT_DETACH macro fallback]

Signed-off-by: Harald Hoyer <harald@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-14 14:49:37 +01:00
Francesco Cosoleto 7c54823c82 fdisk: enable expert menu with SGI label
This allows the creation of a new label if the disk already has an existing
SGI disklabel without working around this problem such as creating a DOS
disklabel or overwriting with zero the partition table (problem reported in
'Gentoo Linux/MIPS Handbook').

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 14:27:18 +01:00
Francesco Cosoleto c482303ef7 fdisk: rewrite print menu system
DOS and SGI label menus are unchanged. BSD label command
descriptions change slightly to use a common form.

This also removes an useless menu entry in SUN label menu to
edit bsd disklabel.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 14:27:18 +01:00
Francesco Cosoleto 56c07b9609 fdisk: move command prompt code to a separate function
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 14:27:18 +01:00
Francesco Cosoleto e97a991aff fdisk: rename bselect, xselect functions
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-11-14 14:23:32 +01:00
Karel Zak 10b7b6439a lib,tt: fix compiler warning [-Wreturn-type]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-14 13:30:12 +01:00
Karel Zak cda9acbe35 readprifile: remove unnecessary optstring array
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-14 13:28:50 +01:00
Karel Zak 115b8b7ce3 Merge branch 'sys-utils-3rd' of https://github.com/kerolasa/lelux-utiliteetit
* 'sys-utils-3rd' of https://github.com/kerolasa/lelux-utiliteetit:
  ldattach: add default case to switches
  ldattach: convert debug macro to function
  ldattach: check numeric user inputs with strtol_or_err
  ldattach: align with howto-usage-function.txt
  ldattach: fix coding style
  docs: add long options to readprofile.8
  readprofile: fix coding style
  readprofile: use libc error printing facilities
  readprofile: add long options
  docs: align tunelp.8 with howto-man-page.txt
  docs: add long options to tunelp.8
  tunelp: add long options and align with howto-usage-function.txt
  tunelp: use libc error printing facilities
  tunelp: use symbolic exit values
  tunelp: fix coding style
  switch_root: add nls support
  switch_root: align with howto-usage-function.txt
  unshare: align with howto-usage-function.txt
  rtcwake: align with howto-usage-function.txt
  setsid: add long options and fix coding style
2011-11-14 13:25:36 +01:00