]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
13 years agoinclude: fix void pointer arithmetics warnings
Sami Kerola [Sun, 10 Jun 2012 14:49:51 +0000 (16:49 +0200)] 
include: fix void pointer arithmetics warnings

all-io.h:18:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]
all-io.h:38:9: warning: pointer of type 'void *' used in arithmetic [-pedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agosysfs: fix printf format warnings
Sami Kerola [Sun, 10 Jun 2012 14:48:31 +0000 (16:48 +0200)] 
sysfs: fix printf format warnings

sysfs.c:93:3: warning: format '%u' expects argument of type 'unsigned
int *', but argument 3 has type 'int *' [-Wformat]
sysfs.c:93:3: warning: format '%u' expects argument of type 'unsigned
int *', but argument 4 has type 'int *' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild: fix unused parameter warnings
Sami Kerola [Sun, 10 Jun 2012 14:44:54 +0000 (16:44 +0200)] 
build: fix unused parameter warnings

pager.c:203:14: warning: unused parameter 'argc' [-Wunused-parameter]
pager.c:203:26: warning: unused parameter 'argv' [-Wunused-parameter]

randutils.c:108:14: warning: unused parameter 'argc' [-Wunused-parameter]
randutils.c:108:26: warning: unused parameter 'argv' [-Wunused-parameter]

optstr.c:774:37: warning: unused parameter 'optstr' [-Wunused-parameter]
optstr.c:774:51: warning: unused parameter 'value' [-Wunused-parameter]
optstr.c:774:65: warning: unused parameter 'valsz' [-Wunused-parameter]
optstr.c:774:79: warning: unused parameter 'next' [-Wunused-parameter]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild: fix redundant redeclaration warnings
Sami Kerola [Sun, 10 Jun 2012 14:37:11 +0000 (16:37 +0200)] 
build: fix redundant redeclaration warnings

env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoinclude: fix spurious list.h warnings
Sami Kerola [Sun, 10 Jun 2012 09:09:08 +0000 (11:09 +0200)] 
include: fix spurious list.h warnings

include/list.h:224:17: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic]
include/list.h:255:19: warning: ISO C forbids omitting the middle term of a ?: expression [-pedantic]

Compilation warned about that at least 110 times.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agouuidd: use output redirection which works [checkbashisms]
Sami Kerola [Sat, 9 Jun 2012 21:20:04 +0000 (23:20 +0200)] 
uuidd: use output redirection which works [checkbashisms]

possible bashism in misc-utils/uuidd.rc line 52 (should be >word 2>&1):
if pidofproc -p $PIDFILE $DAEMON >& /dev/null ; then

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoblkid: fix realloc memory leak [cppcheck]
Sami Kerola [Sat, 9 Jun 2012 21:05:23 +0000 (23:05 +0200)] 
blkid: fix realloc memory leak [cppcheck]

[misc-utils/blkid.c:367]: (error) Common realloc mistake: 'str' nulled but not freed upon failure

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agosetarch: do not use -1 as array index [cppcheck]
Sami Kerola [Sat, 9 Jun 2012 20:45:27 +0000 (22:45 +0200)] 
setarch: do not use -1 as array index [cppcheck]

Negative array index does technically work, but looks awkward and
can confuse static analyser such as cppcheck.

[sys-utils/setarch.c:267]: (error) Array index -1 is out of bounds

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: add compiler warnings
Karel Zak [Wed, 6 Jun 2012 10:10:41 +0000 (12:10 +0200)] 
build-sys: add compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix io_size usage in new API
Karel Zak [Wed, 6 Jun 2012 09:03:23 +0000 (11:03 +0200)] 
fdisk: fix io_size usage in new API

properly implemented fdisk_dev_has_topology() requires optimal
I/O size to detect that the device provides topology.

Unfortunately, currently used cxt->io_size maybe overwritten in
__discover_topology() to min_io_size.

This patch introduces cxt->optimal_io_size and keeps it independent on
cxt->io_size. The cxt->io_size is I/O size used by fdisk for alignment
calculation.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warning [-Wunused-variable]
Karel Zak [Wed, 6 Jun 2012 08:56:29 +0000 (10:56 +0200)] 
fdisk: fix compiler warning [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warning [-Wpointer-sign]
Karel Zak [Wed, 6 Jun 2012 08:53:20 +0000 (10:53 +0200)] 
fdisk: fix compiler warning [-Wpointer-sign]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: fix compiler warnings [-Wsign-compare]
Karel Zak [Wed, 6 Jun 2012 08:48:26 +0000 (10:48 +0200)] 
fdisk: fix compiler warnings [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofdisk: remove user specified sector size global variable
Davidlohr Bueso [Sun, 3 Jun 2012 17:47:44 +0000 (19:47 +0200)] 
fdisk: remove user specified sector size global variable

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add fdisk_dev_sectsz_is_default helper
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:34 +0000 (20:15 +0200)] 
fdisk: add fdisk_dev_sectsz_is_default helper

Instead of printing this warning from the API, add a helper and call it from
fdisk logic.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: use EXIT_SUCCESS for -l option
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:30 +0000 (20:15 +0200)] 
fdisk: use EXIT_SUCCESS for -l option

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add total sectors
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:20 +0000 (20:15 +0200)] 
fdisk: add total sectors

Add the total_sectors variable to the context structure. This is the initial
geometry information.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: add device topology to the API
Davidlohr Bueso [Sun, 3 Jun 2012 18:15:17 +0000 (20:15 +0200)] 
fdisk: add device topology to the API

This patch adds device topology discovery to the internal API. This
functionality is static only to the API and therefore hidden from general fdisk
code. Functionality itself doesn't really change, min_io_size, io_size, logical
and physical sector sizes and alignment offset are added to the fdisk_context
structure and elements are accessed from there. The logical sector size
(sector_size) is now unsigned long instead of unsigned int, this as no effect
otherwise.

A few things to notice:
 - The patch is larger than I wanted but we need to modify function parameters
   across fdisk and its labels to use the topology data from cxt-> instances.
   Hopefully this will be pretty much it regarding this kind of modifications -
   perhaps geometry will need something of the like too.

 - The -b option must override internal discovery.

 - A new helper function has added to verify if the device provides topology
   information, this replaces the 'has_topology' global variable.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: sun: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:24 +0000 (21:44 +0200)] 
fdisk: sun: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: sgi: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:20 +0000 (21:44 +0200)] 
fdisk: sgi: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: dos: use sector_t
Davidlohr Bueso [Sun, 27 May 2012 19:44:17 +0000 (21:44 +0200)] 
fdisk: dos: use sector_t

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: introduce sector_t type
Davidlohr Bueso [Sun, 27 May 2012 19:44:13 +0000 (21:44 +0200)] 
fdisk: introduce sector_t type

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: remove useless comments
Davidlohr Bueso [Sun, 27 May 2012 19:44:07 +0000 (21:44 +0200)] 
fdisk: remove useless comments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: use context as a parameter
Davidlohr Bueso [Sun, 27 May 2012 19:44:04 +0000 (21:44 +0200)] 
fdisk: use context as a parameter

This program heavily uses global variables, which isn't very elegant and can
lead to nasty bugs. Modify functions that use fdisk's context current features
(descriptor and path), to receive the context as a parameter instead of
globally. This includes DOS, SUN, SGI and BSD label code. Another benefit that
comes with this is that as the API grows all the information regarding fdisk
will be accessible from this structure so we can reduce even more global
variables and simply code.

This patch passed:
 - building
 - regression tests
 - local dos/sun/bsd partition changes

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: stop buffering welcome message
Davidlohr Bueso [Sun, 27 May 2012 19:43:56 +0000 (21:43 +0200)] 
fdisk: stop buffering welcome message

Recently, commit 0a86755fe8af1da510d2eca43bdfcd70af098c19 directed the welcome
message output from stderr to stdout breaking regression tests.  Correct this
by flushing stdout and stop buffering the output - a trivial function is
created as well.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agobuild-sys: suid su in make install
Karel Zak [Tue, 5 Jun 2012 15:38:09 +0000 (17:38 +0200)] 
build-sys: suid su in make install

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agologin: fix compiler warning [-Wsign-compare]
Karel Zak [Tue, 5 Jun 2012 14:59:54 +0000 (16:59 +0200)] 
login: fix compiler warning [-Wsign-compare]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 5 Jun 2012 14:57:01 +0000 (16:57 +0200)] 
Merge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit

* '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit:
  docs: clean up getopt.1 manual
  docs: clean up dmesg.1 manual
  docs: clean up chcpu.8 manual
  fileutils: xmkstemp() interface change
  docs: fix all man page groff warnings
  tools: add checkmans.sh
  docs: clean up wdctl.8 manual
  docs: clean up login.1 manual
  login: allow TTYGROUP name begin by number
  build-sys: add su executable to .gitignore
  logindefs: change getlogindefs_num() to return unsigned long

Conflicts:
login-utils/su.c
sys-utils/dmesg.1

13 years agosu: preserve errno in cleanup_pam()
Ludwig Nussel [Tue, 5 Jun 2012 13:31:24 +0000 (15:31 +0200)] 
su: preserve errno in cleanup_pam()

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agoinclide/env: innclude c.h, remove _() macro from xsetenv()
Karel Zak [Tue, 5 Jun 2012 13:44:12 +0000 (15:44 +0200)] 
inclide/env: innclude c.h, remove _() macro from xsetenv()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: trim leading commas from each options string
Dave Reisner [Sun, 3 Jun 2012 16:25:47 +0000 (12:25 -0400)] 
libmount: trim leading commas from each options string

Fixes a bug in option string parsing wherein a line such as:

  ro,relatime,,nosuid,nodev

Will be seen as only the tokens "ro" and "relatime" after the parser
encounters a zero length (and erroneously declared NULL) option.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agobuild-sys: include correct source file for chsh
Dave Reisner [Sat, 2 Jun 2012 17:38:02 +0000 (13:38 -0400)] 
build-sys: include correct source file for chsh

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agosu: use BSD err function instead of gnu's error()
Ludwig Nussel [Fri, 1 Jun 2012 12:51:21 +0000 (14:51 +0200)] 
su: use BSD err function instead of gnu's error()

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: remove unused code
Ludwig Nussel [Fri, 1 Jun 2012 12:51:20 +0000 (14:51 +0200)] 
su: remove unused code

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: replace PAM_BAIL_P macro with better solution
Ludwig Nussel [Fri, 1 Jun 2012 12:51:19 +0000 (14:51 +0200)] 
su: replace PAM_BAIL_P macro with better solution

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: introduce xsetenv globally
Ludwig Nussel [Fri, 1 Jun 2012 12:51:18 +0000 (14:51 +0200)] 
su: introduce xsetenv globally

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: use ENV_PATH resp ENV_SUPATH to be consistent with login
Ludwig Nussel [Fri, 1 Jun 2012 12:51:17 +0000 (14:51 +0200)] 
su: use ENV_PATH resp ENV_SUPATH to be consistent with login

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: use EXIT_FAILURE consistently
Ludwig Nussel [Fri, 1 Jun 2012 12:51:16 +0000 (14:51 +0200)] 
su: use EXIT_FAILURE consistently

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agosu: don't use custom MAX macro
Ludwig Nussel [Fri, 1 Jun 2012 12:51:15 +0000 (14:51 +0200)] 
su: don't use custom MAX macro

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
13 years agolibblkid: add dm-verity hash device detection
Milan Broz [Fri, 1 Jun 2012 11:34:08 +0000 (13:34 +0200)] 
libblkid: add dm-verity hash device detection

dm-verity can use separate device for hash verification,
in this case there is a superblock in the first sector.

See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/device-mapper/verity.txt
for more info.

Signed-off-by: Milan Broz <mbroz@redhat.com>
13 years agolib/strutils: circumvent missing localeconv()
maximilian attems [Thu, 31 May 2012 17:40:49 +0000 (19:40 +0200)] 
lib/strutils: circumvent missing localeconv()

Add stub too nls.h, include it instead of locale.h.
Code in strutils handles already returned NULL.

Signed-off-by: maximilian attems <max@stro.at>
13 years agoMerge branch 'su.1' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 5 Jun 2012 12:47:00 +0000 (14:47 +0200)] 
Merge branch 'su.1' of https://github.com/kerolasa/lelux-utiliteetit

* 'su.1' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: rewrite su.1 manual
  docs: fix email macro in manual example
  docs: add su.1 manual page

13 years agodmesg: fix typo in man page
Karel Zak [Tue, 5 Jun 2012 12:40:10 +0000 (14:40 +0200)] 
dmesg: fix typo in man page

Reported-by: Hemant Borole <hemantborole@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoFix typos in comments and wall's man page
Bernhard Voelker [Tue, 29 May 2012 17:06:50 +0000 (19:06 +0200)] 
Fix typos in comments and wall's man page

Culprits identified again by (newer) misspellings:

  $ git ls-files | misspellings -f - | grep -v '^po/'

* wall: Fix typo in man page.
* Fix typos in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
13 years agotext-utils/hexsyntax.c: fix for missing program_invocation_short_name
Andreas Bießmann [Mon, 4 Jun 2012 11:01:09 +0000 (13:01 +0200)] 
text-utils/hexsyntax.c: fix for missing program_invocation_short_name

Some libc do not expose program_invocation_short_name. Therefore util-linux
comes with helpers in 'c.h'. Use the 'c.h' in hexsyntax.c where it was missed.

This patch fixes following error for me:
---8<---
hexsyntax.c: In function 'newsyntax':
hexsyntax.c:115: error: 'program_invocation_short_name' undeclared (first use in this function)
hexsyntax.c:115: error: (Each undeclared identifier is reported only once
hexsyntax.c:115: error: for each function it appears in.)
--->8---

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
13 years agomore: fix regex error messages printing
Karel Zak [Tue, 5 Jun 2012 12:19:13 +0000 (14:19 +0200)] 
more: fix regex error messages printing

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomore: remove a meaningless test
Jeremy Huntwork [Wed, 23 May 2012 21:51:15 +0000 (17:51 -0400)] 
more: remove a meaningless test

regexec only returns 0 or REG_NOMATCH so remove a meaningless test

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agodocs: clean up getopt.1 manual
Sami Kerola [Sat, 2 Jun 2012 20:39:40 +0000 (22:39 +0200)] 
docs: clean up getopt.1 manual

* Add lightness to synopsis.
* Add spaces after dots (English spacing).
* Replace backticks by ticks.
* Reformat text to be 70 characters wide.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up dmesg.1 manual
Sami Kerola [Sat, 2 Jun 2012 19:57:31 +0000 (21:57 +0200)] 
docs: clean up dmesg.1 manual

* Add lightness to synopsis.
* Add few missing italic highlights to text segments which refer
  command line argument(s).
* Turn off bold where ever possible (makes text unnecessarily heavy).
* Add spaces after dots (English spacing).
* Use URL and email macros where appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up chcpu.8 manual
Sami Kerola [Sat, 2 Jun 2012 19:00:19 +0000 (21:00 +0200)] 
docs: clean up chcpu.8 manual

* Add lightness to synopsis.
* Use argument and parameter highlights consistently.
* Indent dispatch modes.
* Add spaces after dots (English spacing).
* Add line break macros.
* Use URL and email macros where appropriate.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agofileutils: xmkstemp() interface change
Dave Reisner [Sat, 2 Jun 2012 17:31:30 +0000 (19:31 +0200)] 
fileutils: xmkstemp() interface change

We can not let the user control where TMPDIR is for this tempfile.
This will be where we write the updated passwd file, and must be
capable of being moved atomically with rename(2).  Therefore, it
cannot be on a different device, or setpwnam() and vipw/vigr programs
will invariably fail with EXDEV.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: fix all man page groff warnings
Sami Kerola [Sat, 2 Jun 2012 12:50:52 +0000 (14:50 +0200)] 
docs: fix all man page groff warnings

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agotools: add checkmans.sh
Sami Kerola [Sat, 2 Jun 2012 12:36:43 +0000 (14:36 +0200)] 
tools: add checkmans.sh

A script to find whether all manuals has proper groff syntax.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up wdctl.8 manual
Sami Kerola [Sat, 2 Jun 2012 11:48:56 +0000 (13:48 +0200)] 
docs: clean up wdctl.8 manual

Align with Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: clean up login.1 manual
Sami Kerola [Sat, 2 Jun 2012 11:20:36 +0000 (13:20 +0200)] 
docs: clean up login.1 manual

PATH contents for users & root in DESCRIPTION section where wrong,
and couple default values where missing.  Rest of the change is about
making the groff, and the output, to look good.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agologin: allow TTYGROUP name begin by number
Sami Kerola [Sat, 2 Jun 2012 10:11:25 +0000 (12:11 +0200)] 
login: allow TTYGROUP name begin by number

Assuming someone is using a TTYGROUP name beginnign by a digit the
login was misbehaving with 'contains invalid numerical value: %s'
message(s) in syslog.  Please notice that group names that consist
only digits as characters are valid (but likely to cause confusion,
and chaos).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: add su executable to .gitignore
Sami Kerola [Sat, 2 Jun 2012 10:00:48 +0000 (12:00 +0200)] 
build-sys: add su executable to .gitignore

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agologindefs: change getlogindefs_num() to return unsigned long
Sami Kerola [Sat, 2 Jun 2012 09:57:42 +0000 (11:57 +0200)] 
logindefs: change getlogindefs_num() to return unsigned long

Where ever getlogindefs_num() is called return value is always
expected to be unsigned, such as sleep() input, gid_t or mode_t.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: rewrite su.1 manual
Ludwig Nussel [Sat, 2 Jun 2012 05:10:12 +0000 (07:10 +0200)] 
docs: rewrite su.1 manual

Converting coreutils info page to manual did not result as good
manual pages as writing almost completely new.  Ludwig wrote the
text, Sami cleaned up groff syntax.

Reference: http://www.spinics.net/lists/util-linux-ng/msg06321.html
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: fix email macro in manual example
Sami Kerola [Wed, 30 May 2012 17:49:37 +0000 (19:49 +0200)] 
docs: fix email macro in manual example

URL macro is not email address macro.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add su.1 manual page
Sami Kerola [Wed, 30 May 2012 17:44:45 +0000 (19:44 +0200)] 
docs: add su.1 manual page

The manual page is almost one to one copy with GNU Coreutils 'su
invocation' info page.  This manual also includes few examples, fix
to return values, hint about PAM configuration file, authors and see
also sections.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: move configure login options to one place
Karel Zak [Tue, 29 May 2012 13:24:04 +0000 (15:24 +0200)] 
build-sys: move configure login options to one place

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-vipw
Karel Zak [Tue, 29 May 2012 13:20:44 +0000 (15:20 +0200)] 
build-sys: add --enable-vipw

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-newgrp
Karel Zak [Tue, 29 May 2012 13:15:38 +0000 (15:15 +0200)] 
build-sys: add --enable-newgrp

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --disable-su
Karel Zak [Tue, 29 May 2012 12:54:06 +0000 (14:54 +0200)] 
build-sys: add --disable-su

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --enable-chfn-chsh
Karel Zak [Tue, 29 May 2012 12:41:01 +0000 (14:41 +0200)] 
build-sys: add --enable-chfn-chsh

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add --disable-login
Karel Zak [Tue, 29 May 2012 12:14:38 +0000 (14:14 +0200)] 
build-sys: add --disable-login

... to implement fine-grained control on what is built from
login-utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: remove program_name
Karel Zak [Tue, 29 May 2012 10:53:46 +0000 (12:53 +0200)] 
su: remove program_name

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: fix compiler warning [-Wunused-parameter]
Karel Zak [Tue, 29 May 2012 09:01:23 +0000 (11:01 +0200)] 
su: fix compiler warning [-Wunused-parameter]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: remove -DUSE_PAM=1 for su(1)
Karel Zak [Tue, 29 May 2012 08:51:29 +0000 (10:51 +0200)] 
build-sys: remove -DUSE_PAM=1 for su(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosu: Mention SUID_* feature.
Thomas Schwinge [Fri, 25 May 2012 18:41:01 +0000 (20:41 +0200)] 
su: Mention SUID_* feature.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agosu: Add AM_LDFLAGS to su_LDFLAGS.
Thomas Schwinge [Fri, 25 May 2012 18:41:00 +0000 (20:41 +0200)] 
su: Add AM_LDFLAGS to su_LDFLAGS.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agosu: Don't include the unused <sys/fsuid.h>
Thomas Schwinge [Tue, 29 May 2012 08:49:01 +0000 (10:49 +0200)] 
su: Don't include the unused <sys/fsuid.h>

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch 'su-v1' of https://github.com/lnussel/util-linux
Karel Zak [Tue, 29 May 2012 08:43:56 +0000 (10:43 +0200)] 
Merge branch 'su-v1' of https://github.com/lnussel/util-linux

* 'su-v1' of https://github.com/lnussel/util-linux: (105 commits)
  use existing logindefs.c and pathnames.h
  syslog always
  remove non pam code
  make su build as part of util-linux
  call setsid() when called with -c
  make sure /sbin resp /usr/sbin are in PATH
  honor settings in /etc/default/su resp /etc/login.defs
  set sane default path
  log all su attempts
  pam support for su
  Help translators include translation team's web or email address. * src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
  Don't include dirname.h, since system.h does it now.
  Add a bootstrap procedure, so that the CVS version contains fewer files and we bootstrap the rest from gnulib, gettext, etc. * README-cvs: New file. * bootstrap: New file. * bootstrap.conf: New file. * .x-sc_trailing_blank: Remove config-log, .gdb-history.  Add .po. * configure.ac (AC_PREREQ): Move here from m4/*.m4, for benefit of gnulib-tool. (gl_DEFAULT_POSIX2_VERSION, gl_USE_SYSTEM_EXTENSIONS, gl_PERL): (gl_IGNORE_UNUSED_LIBRARIES): Remove; now done by gnulib. (gl_EARLY): Add. (gl_MACROS): Call just after gl_EARLY, just for clarity. * src/c99-to-c98.diff: Remove patch to ls.c; no longer needed. * src/kill.c (strtoimax): Remove decl. * src/ls.c: Include "wcwidth.h" instead of rolling it ourselves. * src/wc.c: Likewise. * src/ls.c (sort_files): Rewrite to avoid need for C99-style declaration, so that we don't need to patch this file. * src/printf.c (strtoimax, strtoumax): Remove decls. * src/su.c: Include getpass.h. (getpass): remove. * src/system.h: Include mempcpy.h, stpcpy.h, strpbrk.h. Include inttypes.h unconditionally; remove decls it handles. * lib/Makefile.am: include gnulib.mk, so that we can remove most of this file. (AM_CPPFLAGS): Don't mention -I$(srcdir), since that's now done for us. (noinst_LIBRARIES, LDDADD, DEFS): Remove. (libcoreutils_a_SOURCES): Trim down greatly, just to the files that aren't in gnulib. Remove defns gnulib does for us. * m4/check-decl.m4 (gl_CHECK_DECLS): Don't include stdio.h, string.h, stdlib.h, unistd.h, sys/time.h, time.h.  Use AC_CHECK_DECLS_ONCE for free, getenv, geteuid, getlogin, getuid, lseek, malloc, memchr, realloc.  Don't check for getutent, memrchr, nanosleep, stpcpy, strndup, strnlen, strstr, strtoul, strtoull. (_gl_DECL_HEADERS): Remove; all uses removed. * m4/jm-macros.m4 (gl_MACROS): Move AC_PREREQ into configure.ac for the benefit of gnulib-tool.  Call gl_INIT. Do not call or require macros that gnulib will handle for us. Don't check for fchmod, hasmntopt, isascii, lchown, listmntent, mempcpy, realpath, wcrtomb, tzset. (gl_CHECK_ALL_HEADERS): Don't check for sys/statvfs.h, sys/vfs.h, sys/mount.h. (gl_CHECK_ALL_TYPES): Require AC_TYPE_UNSIGNED_LONG_LONG_INT. Don't check for struct stat.st_blksize. Don't require AC_STRUCT_ST_DM_MODE, gt_TYPE_SSIZE_T, gl_AC_TYPE_UINT32_T, gl_AC_TYPE_UINTMAX_T, gl_AC_TYPE_UINTPTR_T, gl_AC_TYPE_UNSIGNED_LONG_LONG. * m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_XFTS, gl_ROOT_DEV_INO. Don't require macros that gnulib does for us. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Don't check for sys/sysmacros.h.  Don't check for statvfs.  Use AC_CHECK_HEADERS_ONCE for netinet/in.h, nfs/nfs_clnt.h, nfs/vfs.h. Don't require gl_AC_TYPE_LONG_LONG, gt_HEADER_INTTYPES_H.
  * src/su.c (usage): Correct typo in --help output: s/commmand/command/ Reported by Tim Waugh. Also remove the comment duplicating much of --help output.
  (log_su, run_shell): Use new last_component, in place of base_name.
  Remove unnecessary parens in `#if defined (SYMBOL)' expressions.
  Update FSF postal mail address.
  Update FSF postal mail address.
  (run_shell): Pass a new n_additional_args arg, so that the callee doesn't have to count 'em.  All callers changed. Don't allocate more space for the arg vector than we'll need. Use memcpy to copy the args rather than rolling our own loop. Use size_t for sizes. (fast_startup, simulate_login, change_environment, log_su, correct_password, restricted_shell, main): Use bool for booleans. (longopts): Don't assume change_environment is an int. Use NULL, not 0, for pointers. (xsetenv): New function, replacing xputenv and concat. All callers changed. (elements): Remove; no longer needed. (log_su, correct_passwd, main): Prefer !x to x==NULL. (log_su): 2 -> STDERR_FILENO. (modify_environment, main): Don't assume that getenv's returned value has an indefinite lifetime. (modify_environment): Allocate a larger environ. (main): Remove an impossible 'case 0'; if it happens now, it'll get diagnosed.  Don't assume getpwnam results outlive endpwent. Check for null or empty pw_name, pw_dir and for null pw_passwd.
  (correct_password, restricted_shell, main): Prefer the notation `STREQ (a, b)' over `strcmp (a, b) == 0'.
  ...

13 years agosetsid: Include <sys/ioctl.h> instead of <termio.h>.
Thomas Schwinge [Fri, 25 May 2012 18:16:18 +0000 (20:16 +0200)] 
setsid: Include <sys/ioctl.h> instead of <termio.h>.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agowrite: Don't explicitly include <asm/param.h>.
Thomas Schwinge [Fri, 25 May 2012 18:16:17 +0000 (20:16 +0200)] 
write: Don't explicitly include <asm/param.h>.

It doesn't exist on some systems, but will come in via <sys/param.h> on the
others.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agowrite: Use PATH_MAX instead of MAXPATHLEN, as elsewhere.
Thomas Schwinge [Fri, 25 May 2012 18:16:16 +0000 (20:16 +0200)] 
write: Use PATH_MAX instead of MAXPATHLEN, as elsewhere.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agologin: Include <linux/major.h> only if it exists.
Thomas Schwinge [Fri, 25 May 2012 18:16:15 +0000 (20:16 +0200)] 
login: Include <linux/major.h> only if it exists.

It isn't required on non-Linux systems.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agoinclude/c: move fallback for MAXHOSTNAMELEN to c.h
Karel Zak [Tue, 29 May 2012 08:08:25 +0000 (10:08 +0200)] 
include/c: move fallback for MAXHOSTNAMELEN to c.h

Reported-by: Thomas Schwinge <thomas@codesourcery.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agologger: use memcpy instead of bcopy
Dave Reisner [Mon, 28 May 2012 18:02:59 +0000 (14:02 -0400)] 
logger: use memcpy instead of bcopy

bcopy is marked legacy in POSIX.1-2001 and should not be used.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agoarch, eject, elvtune: Gracefully disable on non-Linux platforms.
Thomas Schwinge [Fri, 25 May 2012 18:16:13 +0000 (20:16 +0200)] 
arch, eject, elvtune: Gracefully disable on non-Linux platforms.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agokill, raw, rename: Don't explicitly enable for --enable-most-builds.
Thomas Schwinge [Fri, 25 May 2012 18:16:12 +0000 (20:16 +0200)] 
kill, raw, rename: Don't explicitly enable for --enable-most-builds.

They're already dealt with in the default configuration.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agolib/pager: repair build for non-Linux.
Thomas Schwinge [Fri, 25 May 2012 18:13:41 +0000 (20:13 +0200)] 
lib/pager: repair build for non-Linux.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agokill: Check the correct variable when configuring.
Thomas Schwinge [Fri, 25 May 2012 18:11:22 +0000 (20:11 +0200)] 
kill: Check the correct variable when configuring.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
13 years agologger: mark decode/pencode as static
Dave Reisner [Wed, 23 May 2012 20:36:00 +0000 (16:36 -0400)] 
logger: mark decode/pencode as static

Move these functions to the top of the file where they can be marked
static and the prototypes can be removed.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agologger: avoid explicit fclose(stdout)
Dave Reisner [Wed, 23 May 2012 20:35:58 +0000 (16:35 -0400)] 
logger: avoid explicit fclose(stdout)

This is done for us via an atexit hook since c05a80ca6385b8. Avoids a
useless 'Write error' on exit whenever invoking the tool.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agomount: (new) fix MS_REC usage
Karel Zak [Mon, 28 May 2012 17:54:16 +0000 (19:54 +0200)] 
mount: (new) fix MS_REC usage

 # mount -R /mnt/test /mnt/test
 mount: propagation flags (--make-* or --bind options) are mutually exclusive

Reported-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agotests: add losetup/mount encryption test
Karel Zak [Mon, 28 May 2012 11:44:55 +0000 (13:44 +0200)] 
tests: add losetup/mount encryption test

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add MNT_ERR_MOUNTOPT
Karel Zak [Mon, 28 May 2012 10:49:55 +0000 (12:49 +0200)] 
libmount: add MNT_ERR_MOUNTOPT

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (new) add loopdev specific error message
Karel Zak [Mon, 28 May 2012 10:26:41 +0000 (12:26 +0200)] 
mount: (new) add loopdev specific error message

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add MNT_ERR_LOOPDEV
Karel Zak [Mon, 28 May 2012 10:26:36 +0000 (12:26 +0200)] 
libmount: add MNT_ERR_LOOPDEV

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (old) fix encryption= usage
Karel Zak [Mon, 28 May 2012 09:37:36 +0000 (11:37 +0200)] 
mount: (old) fix encryption= usage

Addresses: https://github.com/karelzak/util-linux/issues/12
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolosetup: more verbose failed setup error mesage
Karel Zak [Mon, 28 May 2012 09:36:59 +0000 (11:36 +0200)] 
losetup: more verbose failed setup error mesage

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agouse existing logindefs.c and pathnames.h
Ludwig Nussel [Fri, 25 May 2012 08:54:23 +0000 (10:54 +0200)] 
use existing logindefs.c and pathnames.h

I'm not sure having /usr/local in _PATH_DEFPATH_ROOT and even putting it
in front is such a good idea though. /usr/local might be on NFS so could
prevent root from logging in if the network is down.

13 years agosyslog always
Ludwig Nussel [Fri, 25 May 2012 08:21:09 +0000 (10:21 +0200)] 
syslog always

13 years agoremove non pam code
Ludwig Nussel [Fri, 25 May 2012 08:20:57 +0000 (10:20 +0200)] 
remove non pam code

13 years agomake su build as part of util-linux
Ludwig Nussel [Wed, 15 Feb 2012 16:28:28 +0000 (17:28 +0100)] 
make su build as part of util-linux

13 years agocall setsid() when called with -c
Tim Waugh [Fri, 10 Jun 2011 12:13:59 +0000 (14:13 +0200)] 
call setsid() when called with -c

Prevents command injection via TIOCSTI

https://bugzilla.redhat.com/show_bug.cgi?id=173008

13 years agomake sure /sbin resp /usr/sbin are in PATH
Werner Fink [Tue, 17 Aug 2010 07:09:55 +0000 (09:09 +0200)] 
make sure /sbin resp /usr/sbin are in PATH

13 years agohonor settings in /etc/default/su resp /etc/login.defs
Ludwig Nussel [Mon, 9 Aug 2010 14:03:12 +0000 (16:03 +0200)] 
honor settings in /etc/default/su resp /etc/login.defs