]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 years agodocs: update AUTHORS file
Karel Zak [Thu, 13 Dec 2012 12:51:57 +0000 (13:51 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: fix typos
Karel Zak [Wed, 12 Dec 2012 20:01:32 +0000 (21:01 +0100)] 
libmount: fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoblkid: fix double free [coverity scan]
Karel Zak [Wed, 12 Dec 2012 19:48:15 +0000 (20:48 +0100)] 
blkid: fix double free [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: make mkstemp() more robust [coverity scan]
Karel Zak [Wed, 12 Dec 2012 12:32:52 +0000 (13:32 +0100)] 
libmount: make mkstemp() more robust [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoswapon: fix memmory leak [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:40:48 +0000 (12:40 +0100)] 
swapon: fix memmory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: check mkdir(/run/blkid) return code [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:27:05 +0000 (12:27 +0100)] 
libblkid: check mkdir(/run/blkid) return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoswapon: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:18:20 +0000 (12:18 +0100)] 
swapon: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoprlimit: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:16:16 +0000 (12:16 +0100)] 
prlimit: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolscpu: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:13:38 +0000 (12:13 +0100)] 
lscpu: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agonamei: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:12:25 +0000 (12:12 +0100)] 
namei: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolslocks: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:11:17 +0000 (12:11 +0100)] 
lslocks: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:09:44 +0000 (12:09 +0100)] 
lsblk: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofindmnt: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:08:06 +0000 (12:08 +0100)] 
findmnt: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agopartx: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 10:57:40 +0000 (11:57 +0100)] 
partx: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: check lastlog lseek return code [coverity scan]
Karel Zak [Wed, 12 Dec 2012 10:48:08 +0000 (11:48 +0100)] 
login: check lastlog lseek return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agochsh: use return rather than exit in main, clean up man page
Karel Zak [Wed, 12 Dec 2012 09:48:01 +0000 (10:48 +0100)] 
chsh: use return rather than exit in main, clean up man page

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agochfn: always use return rather than exit() in main
Karel Zak [Wed, 12 Dec 2012 09:41:44 +0000 (10:41 +0100)] 
chfn: always use return rather than exit() in main

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agochfn: clean up exit status
Karel Zak [Wed, 12 Dec 2012 09:36:32 +0000 (10:36 +0100)] 
chfn: clean up exit status

The old version in some cases (but not always) returns -1 (255) on
error. It seems better to cleanup the code and don't return internal
return codes by exit().

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: unset *_DEBUG variables
Karel Zak [Mon, 10 Dec 2012 12:43:11 +0000 (13:43 +0100)] 
tests: unset *_DEBUG variables

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't use safe_getenv() for test
Karel Zak [Mon, 10 Dec 2012 12:31:08 +0000 (13:31 +0100)] 
libmount: don't use safe_getenv() for test

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: avoid endless loop in mnt_get_kernel_cmdline_option
Bernhard Voelker [Fri, 30 Nov 2012 16:12:12 +0000 (17:12 +0100)] 
libmount: avoid endless loop in mnt_get_kernel_cmdline_option

The above function infloops when the name to search for can only
be found at the beginning of /proc/cmdline but doesn't match,
e.g. when searching for "ro" in "root=/dev/sda1 quiet vga=0x31a".

* libmount/src/utils.c (mnt_get_kernel_cmdline_option): Replace
while by for loop to ensure the pointer p is incremented.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
12 years agorename: use macro to print version
Karel Zak [Mon, 10 Dec 2012 12:14:38 +0000 (13:14 +0100)] 
rename: use macro to print version

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agorename: add --symlink option for renaming symlink target
Jan (yac) Matějka [Mon, 26 Nov 2012 15:50:08 +0000 (16:50 +0100)] 
rename: add --symlink option for renaming symlink target

[kzak@redhat.com: - coding style clean up]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoblkid: fix man page mess
Karel Zak [Mon, 10 Dec 2012 11:25:25 +0000 (12:25 +0100)] 
blkid: fix man page mess

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: (gpt) check if the "First sector" is unused
Karel Zak [Tue, 4 Dec 2012 17:03:35 +0000 (18:03 +0100)] 
fdisk: (gpt) check if the "First sector" is unused

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: (gpt) align newly created partitions
Karel Zak [Tue, 4 Dec 2012 16:54:15 +0000 (17:54 +0100)] 
fdisk: (gpt) align newly created partitions

 - default "First sector" has to be aligned
 - "Last sector" has to be aligned if specified by +<size><suffix> convention

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: (gpt) fix {last,first}_usable_lba usage
Karel Zak [Tue, 4 Dec 2012 16:02:50 +0000 (17:02 +0100)] 
fdisk: (gpt) fix {last,first}_usable_lba usage

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: cleanup partition start/end usage
Karel Zak [Tue, 4 Dec 2012 15:34:18 +0000 (16:34 +0100)] 
fdisk: cleanup partition start/end usage

 - always use pointers to make the code more generic
 - always use "const" is possible
 - always use le64_to_cpu() to access numbers

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: (gpt) check partitions alignment
Karel Zak [Tue, 4 Dec 2012 14:45:25 +0000 (15:45 +0100)] 
fdisk: (gpt) check partitions alignment

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: report PT type, inform about new GPT
Karel Zak [Tue, 4 Dec 2012 13:58:55 +0000 (14:58 +0100)] 
fdisk: report PT type, inform about new GPT

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: (gpt) use topology to define FirstUsableLBA
Karel Zak [Tue, 4 Dec 2012 13:49:17 +0000 (14:49 +0100)] 
fdisk: (gpt) use topology to define FirstUsableLBA

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agovipw: remove unused set{uid,gid} calls
Karel Zak [Tue, 4 Dec 2012 13:32:15 +0000 (14:32 +0100)] 
vipw: remove unused set{uid,gid} calls

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: clean nonnull attribute usage
Karel Zak [Tue, 4 Dec 2012 13:22:39 +0000 (14:22 +0100)] 
libmount: clean nonnull attribute usage

 - use __attribute__((nonnull) for functions where we not able to
   return an return code ("is", "has" and some "get" functions).

 - use __attribute__((nonnull) for small functions where we
   always modify any of the function argument (some mnt_optstr_* functions)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: re-read PART{UUID,LABEL} for successfully verified cached devices
Karel Zak [Tue, 4 Dec 2012 12:02:57 +0000 (13:02 +0100)] 
libblkid: re-read PART{UUID,LABEL} for successfully verified cached devices

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: cleanup arguments checks
Karel Zak [Tue, 4 Dec 2012 11:12:54 +0000 (12:12 +0100)] 
libblkid: cleanup arguments checks

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: cleanup nonnull attribute usage
Karel Zak [Tue, 4 Dec 2012 10:58:13 +0000 (11:58 +0100)] 
libblkid: cleanup nonnull attribute usage

 - don't mix __attribute__((nonnull)) and "if (!argument) return" for
   the same function. The "if ()" check will be *silently* optimized
   out by gcc.

 - use __attribute__((nonnull)) for functions where is impossible to
   return error code. For example "is" and "has" functions or functions
   where we return unsigned types and zero is a valid value.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: move DOS units stuff to fdiskdoslabel.c
Karel Zak [Mon, 3 Dec 2012 15:22:17 +0000 (16:22 +0100)] 
fdisk: move DOS units stuff to fdiskdoslabel.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: use BLKSSZGET as default for io-limits rather than hardcoded limit
Karel Zak [Mon, 3 Dec 2012 14:50:21 +0000 (15:50 +0100)] 
fdisk: use BLKSSZGET as default for io-limits rather than hardcoded limit

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: remove global variable sector_offset
Karel Zak [Mon, 3 Dec 2012 14:32:16 +0000 (15:32 +0100)] 
fdisk: remove global variable sector_offset

 - add cxt->first_lba as replacement to sector_offset
 - add label->reset_alignment() to overwrite the default alignment setting
 - add fdisk_reset_alignment() to setup grain, first LBA offset, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: zerosize EBR buffer
Karel Zak [Fri, 30 Nov 2012 20:33:06 +0000 (21:33 +0100)] 
fdisk: zerosize EBR buffer

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: api: propagate add partitions to users
Davidlohr Bueso [Mon, 26 Nov 2012 04:29:18 +0000 (20:29 -0800)] 
fdisk: api: propagate add partitions to users

Similarly to commit 1f5eb51b79275e32d045fd6718753bf04cde8374 we
do not propagate problems when adding partitions to user visible
api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: remove dead code
Davidlohr Bueso [Mon, 26 Nov 2012 04:29:12 +0000 (20:29 -0800)] 
fdisk: remove dead code

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: api: move disklabel type to cxt
Davidlohr Bueso [Mon, 26 Nov 2012 04:25:49 +0000 (20:25 -0800)] 
fdisk: api: move disklabel type to cxt

Get rid of it as a global variable as it belongs in the context.
To compare a disklabel on the device, the fdisk_dev_is_disklabel()
function is introduced. Also, to avoid naming issues, the fdisk_labeltype
members where renamed to FDISK_DISKLABEL_<type>.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agoMerge branch '2012wk47' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Fri, 30 Nov 2012 12:43:42 +0000 (13:43 +0100)] 
Merge branch '2012wk47' of git://github.com/kerolasa/lelux-utiliteetit

12 years agobuild-sys: fix typo
Karel Zak [Fri, 30 Nov 2012 11:58:33 +0000 (12:58 +0100)] 
build-sys: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: use pkg-config for selinux
Karel Zak [Fri, 30 Nov 2012 11:48:44 +0000 (12:48 +0100)] 
build-sys: use pkg-config for selinux

- we need libselinux 2.x (where is security_get_initial_context())
- the latest selinux versions are linked with -lpcre

Reported-by: Gregory Nietsky <gregory@distrotech.co.za>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: add devel-non-docs compile profile
Karel Zak [Fri, 30 Nov 2012 11:47:08 +0000 (12:47 +0100)] 
build-sys: add devel-non-docs compile profile

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: don't fails silently if EBR is outside of disk
Karel Zak [Fri, 30 Nov 2012 10:54:10 +0000 (11:54 +0100)] 
fdisk: don't fails silently if EBR is outside of disk

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: cleanup blkid_strconcat
Karel Zak [Fri, 30 Nov 2012 10:10:22 +0000 (11:10 +0100)] 
libblkid: cleanup blkid_strconcat

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: remove blkid_{strndup,strdup}
Karel Zak [Fri, 30 Nov 2012 09:56:54 +0000 (10:56 +0100)] 
libblkid: remove blkid_{strndup,strdup}

Don't try to be smart. Let's use standard libc functions. (Note that
we have fallback for strndup() in include/strutils.h)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: add function attributes to private API
Karel Zak [Fri, 30 Nov 2012 09:33:22 +0000 (10:33 +0100)] 
libblkid: add function attributes to private API

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: add function attributes to public API
Ondrej Oprala [Fri, 30 Nov 2012 09:32:12 +0000 (10:32 +0100)] 
libblkid: add function attributes to public API

[kzak@redhat.com: - use __ul prefix in public API,
                  - define minimal requirement gcc 3.4]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add function attributes to private API
Ondrej Oprala [Fri, 30 Nov 2012 08:01:10 +0000 (09:01 +0100)] 
libmount: add function attributes to private API

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add function attributes to public API
Ondrej Oprala [Fri, 30 Nov 2012 07:56:11 +0000 (08:56 +0100)] 
libmount: add function attributes to public API

[kzak@redhat.com: - use __ul prefix in public API,
                  - define minimal requirement gcc 3.4]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: cleanup TODO
Karel Zak [Tue, 27 Nov 2012 10:13:42 +0000 (11:13 +0100)] 
docs: cleanup TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: fix copy & past bug
Karel Zak [Tue, 27 Nov 2012 09:44:28 +0000 (10:44 +0100)] 
lsblk: fix copy & past bug

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: sanitize paths from non-root users
Karel Zak [Mon, 26 Nov 2012 15:25:46 +0000 (16:25 +0100)] 
umount: sanitize paths from non-root users

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: sanitize paths from non-root users
Karel Zak [Mon, 26 Nov 2012 13:30:22 +0000 (14:30 +0100)] 
mount: sanitize paths from non-root users

 $ mount /root/.ssh/../../dev/sda2
 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

this is too promiscuous. It seems better to ignore on command line
specified paths which are not resolve-able for non-root users.

Fixed version:

  $ mount /root/.ssh/../../dev/sda2
  mount: /root/.ssh/../../dev/sda2: Permission denied

  $ mount /dev/sda2
  mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

Note that this bug has no relation to mount(2) permissions evaluation
in suid mode. The way how non-root user specifies paths on command
line is completely irrelevant for comparison with fstab entries.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/canonicalize: add canonicalize_path_restricted() to canonicalize without suid...
Karel Zak [Mon, 26 Nov 2012 15:24:28 +0000 (16:24 +0100)] 
lib/canonicalize: add canonicalize_path_restricted() to canonicalize without suid permisssions

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: make debug stuff more robust
Karel Zak [Mon, 26 Nov 2012 11:19:02 +0000 (12:19 +0100)] 
libmount: make debug stuff more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: (deprecated) drop --guess-fstype
Karel Zak [Mon, 26 Nov 2012 10:57:26 +0000 (11:57 +0100)] 
mount: (deprecated) drop --guess-fstype

The option is undocumented and unnecessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: correctly interpret '*' from /etc/filesystems
Karel Zak [Mon, 26 Nov 2012 10:21:40 +0000 (11:21 +0100)] 
libmount: correctly interpret '*' from /etc/filesystems

 - single line with '*' in /etc/filesystems means that libmount has to
   read /proc/filesystems, otherwise /proc/filesystems has to be ignored

 - mount(2) ENODEV is no reason to break the do_mount_by_pattern()
   loop when trying to mount by /{etc,proc}/filesystems

Reported-by: NeilBrown <neilb@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: ddate removal
Sami Kerola [Sat, 27 Oct 2012 17:58:54 +0000 (18:58 +0100)] 
docs: ddate removal

Missed in commit 4cf02b65109029a38f708148dea8d2bdf2fa19de

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: mention what Open Group has marked legacy
Sami Kerola [Tue, 23 Oct 2012 19:59:26 +0000 (20:59 +0100)] 
docs: mention what Open Group has marked legacy

Reviewed-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: remove dead link
Sami Kerola [Tue, 23 Oct 2012 19:50:38 +0000 (20:50 +0100)] 
docs: remove dead link

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: mention Open Group requirements
Sami Kerola [Tue, 23 Oct 2012 19:14:53 +0000 (20:14 +0100)] 
docs: mention Open Group requirements

Commands cal col ipcrm ipcs kill line logger mesg more newgrp pg renice
has Open Group requirements.  Contributors need to be aware of them.

Reviewed-by: Adam Sampson <ats@offog.org>
Reviewed-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Reviewed-by: Ángel González <ingenit@zoho.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolscpu: remove unnecessary variable
Karel Zak [Fri, 23 Nov 2012 14:01:27 +0000 (15:01 +0100)] 
lscpu: remove unnecessary variable

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: remove print_perms()
Sami Kerola [Sun, 11 Nov 2012 22:41:24 +0000 (22:41 +0000)] 
ipcs: remove print_perms()

The function is no longer in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoipcs: make individual message queue id printing to use /proc
Sami Kerola [Sun, 11 Nov 2012 22:31:21 +0000 (22:31 +0000)] 
ipcs: make individual message queue id printing to use /proc

[kzak@redhat.com: - fix msgctl() call,
  move q_qbytes to ipc_msg_get_info]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: clean up do_msg(), and add ipc_msg_get_info()
Sami Kerola [Sun, 11 Nov 2012 22:10:54 +0000 (22:10 +0000)] 
ipcs: clean up do_msg(), and add ipc_msg_get_info()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoipcs: make individual semaphore id printing to use /proc
Sami Kerola [Sun, 11 Nov 2012 21:12:20 +0000 (21:12 +0000)] 
ipcs: make individual semaphore id printing to use /proc

And reindent the print_shm() function.

[kzak@redhat.com: move semctl(GET*...) calls to ipcutils.c]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: clean up do_sem(), and add ipc_sem_get_info()
Sami Kerola [Sun, 11 Nov 2012 20:53:07 +0000 (20:53 +0000)] 
ipcs: clean up do_sem(), and add ipc_sem_get_info()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoipcs: make individual shared memory id printing to use /proc
Sami Kerola [Sun, 21 Oct 2012 14:33:25 +0000 (15:33 +0100)] 
ipcs: make individual shared memory id printing to use /proc

And reindent the print_shm() function.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: fix ipc_shm_get_info(), use calloc
Karel Zak [Mon, 5 Nov 2012 16:28:07 +0000 (17:28 +0100)] 
ipcs: fix ipc_shm_get_info(), use calloc

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: clean up do_shm()
Karel Zak [Mon, 5 Nov 2012 15:48:12 +0000 (16:48 +0100)] 
ipcs: clean up do_shm()

 - don't expect maxid as argument in ipc_shm_get_info()
 - if there is @id argument then use it everywhere in ipc_shm_get_info()
 - don't call shmctl() if not necessary in do_shm()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: read shared memory values from /proc
Sami Kerola [Sun, 14 Oct 2012 15:01:05 +0000 (16:01 +0100)] 
ipcs: read shared memory values from /proc

[kzak@redhat.com: - move to ipcutils.{c,h},
                  - fix datatypes to be arch independent]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: determine ipc limits from /proc
Sami Kerola [Sun, 21 Oct 2012 16:40:28 +0000 (17:40 +0100)] 
ipcs: determine ipc limits from /proc

Some of the limit values are not dynamic.  Like in kernel these values
are #defined.

[kzak@redhat.com: - use better names for functions,
                  - add ipcutils.{c,h}
                  - read also shmmax from /proc]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/path: add path_read_u64()
Karel Zak [Mon, 5 Nov 2012 11:28:00 +0000 (12:28 +0100)] 
lib/path: add path_read_u64()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/path: rename functions to be more explicit
Karel Zak [Mon, 5 Nov 2012 11:23:55 +0000 (12:23 +0100)] 
lib/path: rename functions to be more explicit

 ... and to have names compatible with lib/sysfs.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: add /proc and /sys path definitions
Sami Kerola [Sun, 21 Oct 2012 16:39:36 +0000 (17:39 +0100)] 
ipcs: add /proc and /sys path definitions

The necessary proc and sysfs files are tested to be present.  When
information files are missing the ipcs will use obsolted system calls,
and data structures, as fallback.

[kzak@redhat.com: - fix #define _PATH_PROC_IPC_MSG "/proc/sys/kernel/sem" typo]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: log failed logins to btmp
Karel Zak [Thu, 22 Nov 2012 14:23:14 +0000 (15:23 +0100)] 
su: log failed logins to btmp

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: use get_terminal_name() for compatibility with login(1)
Karel Zak [Thu, 22 Nov 2012 13:45:49 +0000 (14:45 +0100)] 
su: use get_terminal_name() for compatibility with login(1)

login(1) uses tty name (!= path) in the syslog messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: use get_terminal_name() from ttyutils.c
Karel Zak [Thu, 22 Nov 2012 13:42:10 +0000 (14:42 +0100)] 
login: use get_terminal_name() from ttyutils.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: add get_terminal_name()
Karel Zak [Thu, 22 Nov 2012 13:36:17 +0000 (14:36 +0100)] 
lib/ttyutils: add get_terminal_name()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: add test program
Karel Zak [Thu, 22 Nov 2012 13:32:21 +0000 (14:32 +0100)] 
lib/ttyutils: add test program

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: create .c file
Karel Zak [Thu, 22 Nov 2012 13:26:41 +0000 (14:26 +0100)] 
lib/ttyutils: create .c file

Well, now all tty stuff are incline functions in include/ttyutils.h.
It's seems more elegant to create regular lib/ttyutils.c for libcommon
and write test program.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: use libcommon.a for lslocks
Karel Zak [Thu, 22 Nov 2012 13:25:10 +0000 (14:25 +0100)] 
build-sys: use libcommon.a for lslocks

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: rename log_su to log_syslog
Karel Zak [Thu, 22 Nov 2012 12:53:25 +0000 (13:53 +0100)] 
su: rename log_su to log_syslog

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: remove @ and # as default kill and erase chars
Karel Zak [Thu, 22 Nov 2012 10:23:53 +0000 (11:23 +0100)] 
agetty: remove @ and # as default kill and erase chars

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: add --{erase,kill}-chars options
Karel Zak [Thu, 22 Nov 2012 10:14:02 +0000 (11:14 +0100)] 
agetty: add --{erase,kill}-chars options

We need way to disable the default kill and erase agetty chars to make
the getty usable for Active Directory users with '@' in username.

It seems that the most extendible solution is to add options that
allow to complete control additional erase/kill chars. If you specify
empty strings then the chars are disabled at all.

Note that this patch is backwardly compatible.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=870854
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: (gpt) don't modify in memory buffers
Karel Zak [Wed, 21 Nov 2012 14:47:56 +0000 (15:47 +0100)] 
libblkid: (gpt) don't modify in memory buffers

LIBBLKID_DEBUG=0xffff blkid -p ....

gpt: ---> call probefunc()
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=1024 len=16384 pr=0xb0b690
GPT entries corrupted
reuse buffer: off=10737417728 len=512 pr=0xb0b690
reuse buffer: off=10737401344 len=16384 pr=0xb0b690
GPT entries corrupted
gpt: <--- (rc = 1)

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agowipefs: Add --force option to force it to erase.
Richard W.M. Jones [Mon, 19 Nov 2012 15:02:13 +0000 (15:02 +0000)] 
wipefs: Add --force option to force it to erase.

Commit c550f728f724360f99aae0fdb45b0589d9a347e0 added O_EXCL when
opening the thing to erase.  This broke the wipefs utility when used
on anything which isn't an unmounted filesystem.  eg. If you use it on
a block device containing partitions, then it won't work because the
kernel recognizes the partitions and so thinks the device is in use.

This change adds the --force option which, when used, undoes the above
flag change.  However you still have to use --force most of the time
when erasing something that isn't a plain unmounted filesystem.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoagetty: make --autologin useful with --skip-login (prompt)
Karel Zak [Mon, 19 Nov 2012 09:54:58 +0000 (10:54 +0100)] 
agetty: make --autologin useful with --skip-login (prompt)

The --autologin prints

hostname login: username (automatic login)

message. This commit allows to suppress the message at all if
--skip-login (aka skip prompt) is specified.

It means that

agetty --skip-login --noissue --autologin foouser

does completely silent autologin.

Addresses: https://github.com/karelzak/util-linux/issues/21
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agouuidgen: fix --random
Karel Zak [Mon, 19 Nov 2012 08:50:08 +0000 (09:50 +0100)] 
uuidgen: fix --random

Addresses: https://github.com/karelzak/util-linux/issues/20
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: (recursive) add a cache to the table
Dave Reisner [Fri, 16 Nov 2012 04:18:07 +0000 (23:18 -0500)] 
umount: (recursive) add a cache to the table

Without this table libmount will not resolve paths, meaning that
umounting by relative path will fail.

[kzak@redhat.com: - use mnt_context_get_cache() to make it sensitive
                    to --no-canonicalize cmdline option]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: fix support of comma-separated fs types lists
Gleb Fotengauer-Malinovskiy [Thu, 27 Sep 2012 16:48:34 +0000 (20:48 +0400)] 
libmount: fix support of comma-separated fs types lists

# grep cdrom /etc/fstab
/dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0
# mount /media/cdrom
mount: unknown filesystem type 'udf,iso9660'

# mount -t udf,iso9660 /dev/sr0 /media/cdrom
mount: /dev/sr0 is write-protected, mounting read-only

[kzak@redhat.com: - add some comments
                  - don't try to found external helpers for the types]

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: (recursive) don't call umount(2) for already unmounted targets
Karel Zak [Thu, 15 Nov 2012 15:44:07 +0000 (16:44 +0100)] 
umount: (recursive) don't call umount(2) for already unmounted targets

In the umount --recursive we follow entries from mountinfo, but the
entries maybe already obsolete. Especially if the hierarchy of the
mountpoints contains shared subtrees and umount(2) for one entry may
generate umount for some other entry too.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add shared subtrees to umount --recursive test
Karel Zak [Thu, 15 Nov 2012 15:42:56 +0000 (16:42 +0100)] 
tests: add shared subtrees to umount --recursive test

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't reset NOSWAPMATCH context flag
Karel Zak [Thu, 15 Nov 2012 15:42:05 +0000 (16:42 +0100)] 
libmount: don't reset NOSWAPMATCH context flag

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't try to play with loopdevs if umount argument is really mountpoint
Karel Zak [Thu, 15 Nov 2012 14:59:59 +0000 (15:59 +0100)] 
libmount: don't try to play with loopdevs if umount argument is really mountpoint

Signed-off-by: Karel Zak <kzak@redhat.com>