Commit Graph

8530 Commits

Author SHA1 Message Date
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Sami Kerola f627750083 textual: use version printing macro everywhere
Only mount, umount, and blkid remains not using the macro because they
are print also library references.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Sami Kerola c5c056e7fe flock: add error message to translations
And remove type casting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:18 +02:00
Sami Kerola 1bcf491a78 textual: fix couple typos in comments
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:15 +02:00
Sami Kerola bf60e9f12d hexdump: remove deprecation message
Message 'calling hexdump as od has been deprecated in favor of GNU
coreutils od' has informed the hexdump not to be used like that for three
and half years, and five releases.  It is time to get rid of notice.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:12 +02:00
Sami Kerola 7d2600e2d0 docs: update deprecation banners
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:11 +02:00
Sami Kerola a12124ce7a swapon: align available columns section in usage()
Commit 5db57cfc46 missed doing this change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:10 +02:00
Karel Zak eef6397023 cfdisk: don't modify ncurses LINES and COLS
On Sun, Sep 28, 2014 at 01:48:38AM -0700, pv4 wrote:
 If ncurses is build with --enable-reentrant, building
 util-linux-2.25.1 fails with the folllowing error:

     disk-utils/cfdisk.c: In function 'resize':
     disk-utils/cfdisk.c:202:9: error: lvalue required as left operand of assignment
        LINES = ws.ws_row;
              ^
     disk-utils/cfdisk.c:203:8: error: lvalue required as left operand of assignment
        COLS = ws.ws_col;
             ^

 man COLS gives the following:

     Depending on the configuration, these may be actual variables,
     or macros (see curs_threads(3X)) which provide read-only
     access to curses's state.  In either case, applications should
     treat them as read-only to avoid confusing the library.

Addresses: https://github.com/karelzak/util-linux/issues/125
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-01 11:38:49 +02:00
pcpa 1d966345df su: print proper core dump message when killed
An example is, in one terminal "sudo su -; echo $$", and in
another terminal, "kill -9  $PID" (the pid of the su -). It
should not print "(core dumped)", unless the kill signal
specified so, e.g. kill -7 or kill -11.

Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade@gmail.com>
2014-10-01 10:23:48 +02:00
Karel Zak 937d6af4e1 tests: fix the ipcs test for shmall being too big to show
Based on hints from Adam Sampson, Ruediger Meier and Sami Kerola.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-01 10:13:09 +02:00
Søren Holm 41510d26dd libmount: don't return root if path contains // or ending /
If the path fx. is /foo/bar/ the initial stripoff will replace the last slash
with \0 and return a pointer to that exact \0 character. The same thing will
happen if the path contains // somewhere.

Signed-off-by: Søren Holm <sgh@sgh.dk>
2014-10-01 10:01:35 +02:00
Benno Schulenberg 42f00a7df5 textual: there may be no space between option and optional =arg
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:11 +02:00
Benno Schulenberg 298dc4ff6b textual: angular brackets around a non-literal argument, singular
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:10 +02:00
Benno Schulenberg 548696c442 textual: grammarize another error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:09 +02:00
Benno Schulenberg 7a853ebc38 textual: using angular brackets around individual arguments
And separate short and long options with the standard comma.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:08 +02:00
Benno Schulenberg 6269814950 textual: grammarize an error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:07 +02:00
Benno Schulenberg b73142b97a textual: not using angular brackets around literal arguments
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:06 +02:00
Benno Schulenberg 8d7a6285ec textual: add a comma for clarity, plus some other tweaks
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:05 +02:00
Benno Schulenberg ee7ea5c85e textual: use a somewhat clearer and more standard failure message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:04 +02:00
Benno Schulenberg 1c75610ff8 textual: "ambivalent" applies to intentions, "ambiguous" to results
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:03 +02:00
Benno Schulenberg 09638694d4 textual: use angular brackets around each individual argument
In usage texts each word that is an argument should be marked
separately with angular brackets.  Also add a translator comment.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:02 +02:00
Karel Zak 85fbe4118f lslogins: free after error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-26 11:25:24 +02:00
Karel Zak 30ea015b87 lslogins: cleanup after error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-26 11:23:32 +02:00
Karel Zak 8a4c64e6ac mount: improve --move docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-25 11:01:39 +02:00
Karel Zak 286f1e229b Merge branch 'misc' of git://github.com/kerolasa/lelux-utiliteetit
* 'misc' of git://github.com/kerolasa/lelux-utiliteetit:
  textual: share crypt() error message in sulogin and newgrp
  newgrp: avoid use of obsolete getpass() function
  newgrp: use libc function to read gshadow if it is available
  setarch: use personality() system call when it is available
  setarch: reindent code
  hwclock: remove referal to deprecated keyboard interface
  eject: make open_device() and select_speed() to use struct eject_control
  eject: add struct eject_control to remove global variables
  mountpoint: simplify if statement
  mkfs.minix: fix couple compiler warnings
  mountpoint: add struct mountpoint_control
  last: improve code readability by renaming variable names
  last: make is_phantom() when kernel config does not include audit support
  lib: remove xgetpass()
  include: simplify fputc_careful() in carefulputc.h
  libuuid: add extern qualifiers to uuid/uuid.h system header
2014-09-22 14:55:37 +02:00
Karel Zak fb2ba06663 Merge branch 'renice' of git://github.com/kerolasa/lelux-utiliteetit
* 'renice' of git://github.com/kerolasa/lelux-utiliteetit:
  renice: reorder usage() option descriptions
  rename: add getpriority() message lookup table
  renice: fix numeric uid argument parsing
  renice: avoid having same lines of code twice
  renice: disallow --priority <arg> without pid argument
  rename: use usage and version print out macros
  renice: reorder functions to avoid need of function prototype
2014-09-22 14:43:30 +02:00
Karel Zak 05dd1d1d61 lib/swapprober: add missing header file
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-22 14:26:54 +02:00
Karel Zak 18b3e5495b swapon: split swapon-common.c
swapon    - requires libmount and libblkid
 swapoff   - requires libmount
 swaplabel - requires libblkid

This patch add lib/swapprober.c with blkid stuff for swap. It allows
to use and link libblkid only when necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-22 13:16:25 +02:00
Andreas Henriksson 5ec85227ad logger: gettimeofday needs <sys/time.h>
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>
2014-09-22 12:54:11 +02:00
Andreas Henriksson 53e8c16e14 build-sys: build libmount everywhere
This enables libmount to build on non-linux, which also
means we can build fsck on non-linux again.
(Since the context part of libmount still needs porting,
building the mount utility has instead been restricted
to only build on Linux.)

This has been build-tested on Debian GNU/kFreeBSD.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-09-22 12:54:10 +02:00
Andreas Henriksson 200cdfa8b1 libmount: only include context on linux
This is part of an attempt to make libmount buildable on non-linux.

The parts that need architecture specific porting is under
the context*.c files and the rest of libmount is useful/used
by for example fsck.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-09-22 12:54:09 +02:00
Andreas Henriksson e624bc558b libmount: only invoke loopcxt on linux
This is part of an attempt to make libmount buildable on non-linux.

The support for /dev/loop* is Linux-specific so just disable
it on non-linux for now.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-09-22 12:54:07 +02:00
Robert Schiele 4fcb0f3fb8 umount: read mountinfo if --detach-loop given
Don't use the optimization not to read mountinfo from commit
6a52473ecd if --detach-loop was given
since we need the name of the loop device in that case and with the
optimization this is not present and thus the detach operation
obviously fails.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
2014-09-22 12:53:57 +02:00
Eugene Yunak d106c83b19 cal: `color` option documentation should match actual behaviour 2014-09-21 15:51:57 +03:00
Sami Kerola 94b1623be3 renice: reorder usage() option descriptions
Make the Usage: and Options: sections to be in same order, which I found
to be quicker to use than alphabetical order.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola ce4030e484 rename: add getpriority() message lookup table
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 80ca9e2039 renice: fix numeric uid argument parsing
The following was inconflict with what usage() tells are valid option
arguments.

$ renice 1 -u 1000
renice: unknown user 1000
$ id
uid=1000(kerolasa) ...

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 00b490f002 renice: avoid having same lines of code twice
Add getprio() function to avoid duplication of a simple task.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:13 +01:00
Sami Kerola 0bb01bb0b7 renice: disallow --priority <arg> without pid argument
Earlier a lonely priority with an argument but without pid resulted to no
action and success, when the invocation should have failed.

$ renice --priority 42 ; echo $?
0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 6dcc066f3b rename: use usage and version print out macros
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 5ebcab664e renice: reorder functions to avoid need of function prototype
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:12 +01:00
Sami Kerola 453fc7165d textual: share crypt() error message in sulogin and newgrp
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:03 +01:00
Sami Kerola 8f663a674d newgrp: avoid use of obsolete getpass() function
Read a password from user with termios, and once the password data is no
longer needed ensure it gets overwrote before unallocating memory.

Reference: http://man7.org/linux/man-pages/man3/getpass.3.html
Reference: https://www.securecoding.cert.org/confluence/display/seccode/MSC06-C.+Beware+of+compiler+optimizations
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:03 +01:00
Sami Kerola c829aebc39 newgrp: use libc function to read gshadow if it is available
The glib versionf of getsgnam() is using /etc/nsswitch.conf, allowing the
group passwords to come from external database.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola 9ed11cc260 setarch: use personality() system call when it is available
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola 77eb13b965 setarch: reindent code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola 846c7d30b3 hwclock: remove referal to deprecated keyboard interface
The KDGHWCLK has been gone quite a while.

Reference: http://marc.info/?l=linux-kernel&m=104171103925897
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola 25a3fa8159 eject: make open_device() and select_speed() to use struct eject_control
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola 257a003528 eject: add struct eject_control to remove global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Sami Kerola ee5de88c51 mountpoint: simplify if statement
Returning straight after print_devno() makes the code to be more obvious
and removes need for long else statement.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:01 +01:00