Commit Graph

8929 Commits

Author SHA1 Message Date
Sami Kerola 5de50f26fc docs: add howto-pull-request.txt
Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/10431
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 21:57:44 +00:00
Sami Kerola 7f9916c21e docs: small improvements to howto-contribute.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 21:57:44 +00:00
Karel Zak 8501d9befe libsmartcols: use ASCII art for trees rather than padding
Based on patch from  Roman Odaisky.

References: https://launchpad.net/bugs/1406133
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-07 15:20:22 +01:00
Karel Zak 2fa60c5ec2 build-sys: support nsenter.static
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-07 10:59:16 +01:00
Sami Kerola 730ae9c899 fsck.minix: fix segmentation fault
Return from check_file() and check_file2() functions when maximum name
depth is reached.  The use unsafe strncpy() is also removed just to be on
safe side.

Addresses: https://bugs.debian.org/773892
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:14:13 +01:00
Sami Kerola 64a265bf8a lslocks: fix type warning
misc-utils/lslocks.c:229:2: warning: format '%x' expects argument of type
'unsigned int *', but argument 3 has type 'int *' [-Wformat=]

Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/locks.c?id=5e0f872c7d7e371fbdf09e864eddd24bddfda8fe#n2533
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:14:11 +01:00
Sami Kerola 7ee26cbf02 maint: fix shadow declaration
This change fixes all shadow declarations.  The worth while to mention
fix is with libfdisk sun geometry.  It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.

libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]

That could have caused earlier some unexpected results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:08:21 +01:00
Karel Zak 185aa9e5b8 fallocate: create mode 0666, that's what umask is for
User's umask will typically mask the mode down to 0664 or 0644.

Reported-by: Peter Cordes <peter@cordes.ca>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-07 09:57:55 +01:00
Karel Zak f43fb23a2f libmount: (monitor) make mnt_monitor_next_changed() usable for epoll version too
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 8f52496d8e linmount: (monitor) refresh docs, headers and symbols table
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 3b2c2ba688 libmount: (monitor) use inotify for utab lock file
It's better than monitor utab directly. The utab is updated by
rename(2) and it's really tricky for inotify, because it's necessary
to monitor all /run/mount directory and then it's necessary to verify
that the renamed file is really "utab".

The new concept is without possible false positives and it also
triggers the change when utab update is really done.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 3c5ed29a93 libmount: (monitor) add kernel mountninfo monitoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 9b4fc141d4 libmount: (monitor) cleanup wait/verify stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak f7ca1a6433 libmount: make public top-level monitor FD only
We need full control on changes evaluation, so it's better to
hide all in our private epoll. This change also significantly
simplify the API.

 mn = mnt_new_monitor();
 mnt_monitor_enable_userapce(mn, TRUE, NULL);
 mnt_monitor_enable_kenrel(mn, TRUE);

 fd = mnt_monitor_get_fd(mn);
 ...
   <use 'fd' in epoll controlled by your application>
 ...
 while (mnt_monitor_next_changed(mn, &filename, NULL) == 0)
 	printf("%s: change detected\n", filename);

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 36813a2128 libmount: monitor unref function refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak c6b1e56d26 libmount: cleanup monitor test
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak fc79d3ab44 libmount: split monitor initialization
The patch introduces mnt_monitor_enable_*() functions (now for
userspace only) to make the API easy to use for high-level purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 16:19:02 +01:00
Karel Zak 17bf9c1c39 ipcrm: fix usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 11:55:21 +01:00
Benno Schulenberg 7009af0e0d ipc*: use customary fputs() instead of fprintf() with the usage macros
Also use the clearer word <number> with the --semaphore option.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:50:18 +01:00
Benno Schulenberg 331d255261 tailf: slice up the usage text for ease of translation
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:47:25 +01:00
Benno Schulenberg dfe6a6d085 look: slice up the usage text for ease of translation
Also use the standard macros, and correct the synopsis: use angular
brackets and show that look accepts multiple files.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:46:11 +01:00
Benno Schulenberg 5f55b39e58 colcrt: slice up the usage text for ease of translation
Also use the standard macros for outputting it.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:44:24 +01:00
Benno Schulenberg 26b0b857c9 textual: list the options of setarch in a more alphabetical order
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:43:16 +01:00
Benno Schulenberg 682430494c setarch: make the usage synopsis comprehensible for translators
Use two separate strings for the two different forms of setarch,
instead of filling in an untranslated word into a single string.
Also use the standard angular brackets for nonliteral arguments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:42:41 +01:00
Benno Schulenberg 6ad5b22ca6 docs: restore the alternative form of setarch in its man page
Commit c372860ddb accidentally removed
the alternative form of setarch in which the command name specifies
the architecture to be set.  Also improve some formatting.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:41:03 +01:00
Benno Schulenberg 4e788f4621 ipcrm: gettextize the command synopsis of the usage text
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:41:03 +01:00
Benno Schulenberg afd86656de ipcs: in usage show resource option as nonoptional when used with -i
Also, the resource option -a is not valid with -i, so show the valid
ones explicitly.  Also gettextize the synopsis as a single string, as
the two lines are tightly related and other synopses do this too.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:40:01 +01:00
Benno Schulenberg 92f1c5ab8d docs: improve some wordings on the man page of wipefs
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:38:29 +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
Karel Zak 4a98629b29 chsh: keep struct options in .rodata
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 11:00:51 +01:00
Karel Zak 84705c8b89 chsh: simplify get_shell_list()
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-06 10:57:09 +01:00
Sami Kerola 1fd15f04b3 newgrp: set function arguments read-only when possible
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:53:01 +00:00
Sami Kerola 51c52acfb1 newgrp: move shell determination closer where it is used
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:53:01 +00:00
Sami Kerola 477135dfec newgrp: simplify if else clauses
The 'if' clauses that have termination as either of the control flow
results will never need 'else'.  Making the termination to happen true
flow is enough.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:53:01 +00:00
Sami Kerola 9a5cbe5223 chsh: fail get_shell_list() check when /etc/shells cannot be opened
And get rid of stdbool.h true/false usage.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola 1df0219f2c chsh: simplify check_shell()
Shell null check is redundant.  The shell can be null only after
ask_new_shell returned such, and that is checked earlier in program
logic.

Secondly the check_shell does not need to return values, in such cases
the program can simply exit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola e323df25f5 chsh: rewrite function interacting with user to get path to new shell
Rename prompt() to ask_new_shell().  Remove fixed size buffer and
allocate path to new shell, that should make Hurd people happy.  Use
strutils.h for white space trimming.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola 68b24d53e1 chsh: clean up parse_argv()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola f64979233f chsh: allow user to set shell to /bin/sh if none is set
Earlier setting a /bin/sh was impossible for users that had nothing set
as shell, as that was seen as no change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola 561c48582c chsh: set few variables read-only and rename one of them
This change also improves couple variable initializations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:51 +00:00
Sami Kerola 1cb122d591 chsh: use getline() to support arbitrarily long lines
Use of fgets() can make a single long line to be understood as two
entries, and someone could play tricks with the remainder part of the
buffer.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:50 +00:00
Sami Kerola 144ae70ef3 chfn, chsh: share illegal_passwd_chars() function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:50 +00:00
Sami Kerola 5eef61296f chsh: remove function prototypes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:52:50 +00:00
Karel Zak 8c9615a99b cfdisk: improve Dump dialog
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:53:50 +01:00
Karel Zak 702d0e1cef cfdisk: improve menu clean function
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:42:24 +01:00
Karel Zak 7509020126 cfdisk: detect too small partition sizes
References: https://github.com/karelzak/util-linux/issues/136
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:13:25 +01:00
Karel Zak bf6c15ed4a chfn: fix compilation without libuser
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-19 15:05:04 +01:00
Karel Zak 2e28ebff99 more: fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-19 14:34:03 +01:00
Karel Zak 47123602e6 Merge remote-tracking branch 'sami/2014wk49'
* sami/2014wk49:
  chfn: make command to obey login.defs CHFN_RESTRICT instructions
  chfn: remove set_changed_data() and add add_missing()
  chfn: rename prompt() to ask_new_field()
  chfn: move new and old finger structs to chfn control struct
  chfn: clean up parse_argv()
  chfn: add minimalistic struct chfn_control
  chfn: simplify parse_passwd() by using strsep()
  chfn: fix usage() regression
  chfn: use xasprintf() rather than bunch of strlen() and malloc() calls
  chfn: rewrite prompt() to use strutils
  chfn: remove function prototypes
  lslogins: use hardcoded paths from pathnames.h
  lslogins: add space to systemd journal header and message
  lslogins: reject unknown time format arguments
  lslogins: fix short options
  lslogins: tell why command failed
  lslogins: make journald last logs time stamps to honor --time-format
  lslogins: allow changing password changed and expiration time formats
2014-12-19 14:28:42 +01:00
Karel Zak 929c257548 ipcs: fix shmctl() usage
The function shmctl() has to be called with 'struct shmid_ds', and if
you need 'struct shminfo' then the right way is to cast:

bad way:
  struct shm_info info;

  shmctl(0, SHM_INFO, &info);

right way:
  struct shmid_ds buf;
  struct shm_info *info;

  shmctl(0, SHM_INFO, &buf);
  info = (struct shm_info *) &buf);

The patch also fixes bug in ipc_shm_get_limits() where is missing
lim->shmmax in code based on shmctl().

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-19 13:42:41 +01:00