Commit Graph

2706 Commits

Author SHA1 Message Date
Sami Kerola 94a50e285a mkswap: use xalloc
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-02-21 15:29:49 +01:00
Sami Kerola 00a7d0d2f0 mkswap: use libc error messaging facilities
[kzak@redhat.com: - use "%s from %s" for -V output]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21 15:27:52 +01:00
Karel Zak 1201340290 tests: add tests for [u]mount regular file
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21 15:12:30 +01:00
Petr Uzel f4612577c9 umount: allow unmounting loopdev specified by associated file
Make it possible to unmount a filesystem on a loop device if it is
specified by associated backing file. It does not attempt to unmount
anything if there are more than one loop device associated with the
given file.

Umount looks for associated loopdevice(s) only if umount is called
with the regular file as an argument.

Before:
	mount -o loop -t ext2 img mnt
	umount -v img
	> Could not find /home/puzel/upstream/util-linux/img in mtab
	> umount: img: not mounted

After:
	mount -o loop -t ext2 img mnt
	umount -v img
	> img is associated with /dev/loop0, trying to unmount it
	> /dev/loop0 has been unmounted

[kzak@redhat.com: - fix memory leak in lomount.c]

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=666161
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21 14:54:43 +01:00
Petr Uzel 8ba013af64 include: [xalloc.h]: mention strdup in the file description
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-21 14:41:37 +01:00
Petr Uzel 4581647a62 lscpu: use xstrdup from xalloc.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-21 14:41:36 +01:00
Petr Uzel b642d0e0c9 losetup: spelling fixes
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-21 14:41:34 +01:00
Sami Kerola 85bf44b714 hexdump: new usage(), xalloc and err.h stuff
New usage help screen and print version switch. Also fixes to
exit codes, util linux xmalloc replaced emalloc and every error
print is using libc error function.

[kzak@redhat.com: - minor changes in formatting and coding style]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21 14:38:23 +01:00
Jens Kristian Søgaard 4dad230ffb ipcs: really show all resources when -a and -i are combined
When you have more than one resource with the same id (but differing
types) combining -a and -i does not show all resources. This patch
corrects that.

Signed-off-by: Jens Kristian Søgaard <jens@mermaidconsulting.dk>
2011-02-21 14:26:45 +01:00
Karel Zak cc6b1d11ea lsblk: fix readlink() usage
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-18 14:36:04 +01:00
Karel Zak 5b7cb8687f Revert "libmount: do not check for EAGAIN after flock()"
Linux is not 100% POSIX compatible in this area...
 strace: "flock(3, LOCK_EX|LOCK_NB)   = -1 EAGAIN (Resource temporarily unavailable)"

This reverts commit 78d8c28f74.
2011-02-18 10:53:50 +01:00
Karel Zak 48399694a9 Revert "libuuid: do not check for EAGAIN after flock()"
Linux is not 100% POSIX compatible in this area...
 strace: "flock(3, LOCK_EX|LOCK_NB)   = -1 EAGAIN (Resource temporarily unavailable)"

This reverts commit d6c8d399b9.
2011-02-18 10:52:22 +01:00
Karel Zak 7be3d92f88 build-sys: add uuid_generate_time_safe.3 .gitignore
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 16:32:36 +01:00
Karel Zak 19a9d0b7c3 docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 16:30:52 +01:00
Karel Zak d73fd39176 chsh: fix gcc link() warn_unused_result warning
setpwnam.c:176:9: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 12:00:36 +01:00
Karel Zak f1c2eaac53 fsck: fix -C parsing
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:56:51 +01:00
Karel Zak 9da2972c15 tests: [cpuset] call free() for range
The free() before exit() is not so important, but let's keep the
example code nice and consistent.

Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:26:36 +01:00
Karel Zak d8bee4cb24 chsh: fix small memory leak
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:23:24 +01:00
Karel Zak 81e9987bf0 login: does not ignore setgid() return code for non-roots
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:16:43 +01:00
Karel Zak 2fa3fbe858 fdisk: more robust whole-disk detection
In lib/wholedisk.c, i is set to 0. If fd was a -1, then at
line 18 geometry.start is used without it being initialized.

Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:02:26 +01:00
Karel Zak e47bce7822 libuuid: move __uuid function to UUIDD_PRIVATE in uuid.sym
The private functions for uuidd should not be included in the normal
versioned part or the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 16:36:18 +01:00
Petr Uzel e3d4e31c94 libuuid: update manpage, mention uuid_generate_time_safe
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:16 +01:00
Petr Uzel 5ce8da3c33 libuuid: introduce uuid_generate_time_safe()
The problem with libuuid interface is that it is impossible to
inform the caller of uuid_generate_time() if the UUID was generated
in a safe manner (either via uuidd, or using the global clock state
counter).

This patch introduces new function,

int uuid_generate_time_safe(uuid_t out)

which can report whether the generated UUID is safe.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:16 +01:00
Petr Uzel 46bae9f340 libuuid: __uuid_generate_time(): report if clock_seq is safe
Propagate return value from get_clock() through __uuid_generate_time().

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 70b989c280 libuuid: rename uuid__generate_* to __uuid_generate_*
Having uuid_generate_time and uuid__generate_time at
the same time is confusing. These functions are exported,
but not part of the official API (used by uuidd only).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 34b2e3f133 libuuid: get_clock(): report if the clock_seq is safe
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 20c04820d1 libuuid: do not use invalid file descriptor
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 62b47b3acb libuuid: manpage spelling fixes
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 7491ee6a5a libuuid: fix test in get_clock()
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 559e48112e uuidd: fix manpage: libuuid(3) does not exist
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Benno Schulenberg 144df9a2a8 partx: improve clarity of some messages, gettextize two missed ones
[kzak@redhat.com: - use <disk> rather than <device> in
                    error/verbose messages]

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 15:53:30 +01:00
Benno Schulenberg e8ab5ce3d0 textual: improve the wording of some error and usage messages
[kzak@redhat.com: - cleanup lscpu(1) usage text
                  - use <disk> rather than <device> in partx(8)
                    usage text]

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 15:46:38 +01:00
Benno Schulenberg e22d8b9519 textual: fix three typos in message strings and improve consistency
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-02-16 15:30:13 +01:00
Sami Kerola 0a09eb4efc fsck: use xmalloc, warn & err and new usage
All compler errors reported by -Wall -Wextra -pedantic are fixed.

The patch also makes fsck to use xalloc instead of it's own malloc.
That will make fsck to exit, which could be good thing, at sections
where it previously did not.

Almost all print outs where touched, where various printfs where
converted to warn or err messages.

Finally theres a fix to counter wrap bug that could (very unlikely)
manifest itself if an user specifies same flag exactly UINT_MAX times.

[kzak@redhat.com: - coding style
                  - define XALLOC_EXIT_CODE
                  - use verbose++ in main()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 15:20:11 +01:00
Sami Kerola 47a4b840c3 docs: favour small patches
http://www.spinics.net/lists/util-linux-ng/msg04084.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-02-15 10:34:41 +01:00
Dave Reisner f9e05dafd0 lib: [strutils] avoid integer overflow on large values
This is visible on a 2TB disk via lsblk, where a large partition
incorrectly displays as 1.171798692T instead of 1.8T. This is
corrected by using a uint64_t type instead of a simple int --
consistant with the type used in lsblk.c to represent the raw size in
bytes.

[kzak@redhat.com: - add EiB support
                  - add size_to_human_string() to regression tests]

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-15 10:13:31 +01:00
Sami Kerola bf6db55ad5 more: new usage output, and some trivial fixes
Usage output screen got to be completely rewrote. Aim is to
assist user to determe which switches to use without reading
manual page. The change also introduced new option to see command
version.

Determination if the executable name is `page' is now easy to see
in source, and effect of using the name is mentioned in manual
page.

Rest of the change is trivial; exit values to compiler warning
removals, magic constants to preprocessor definitions, symbolic
exit values, comment pretty printing and #endif markups.

[kzak@redhat.com: - coding style
                  - add __unused__ attribute to signal handlers]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-15 10:13:19 +01:00
WUEBBELS, Josef \(Extern\) 912d6b9892 logger: support for logging to UDP socket / remote syslog server
It adds the ability to logger to log a message to a udp socket.  The -n option
followed by the hostname of the remote host is mandatory to do this.  The
optional -P option can be used to change the UDP destination port (default
514).  The function udpopenlog is used to open the udp socket. After that
everything works in almost the same way like it does when logging to a UNIX
socket.

Signed-off-by: Josef Wuebbels <josef.wuebbels@mtu.de>
2011-02-14 17:59:28 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Fabian Groffen 4a01477b12 sfdisk: rename warn to my_warn
To avoid a conflict with the warn function from err.h, renamed warn to
my_warn, as the functionality of both is not the same.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:17:10 +01:00
Davidlohr Bueso c80790440e mkfs.minix: general cleanups
This patch provides some minor code fixes: add/remove some macros and close the device after usage.
Also modifies usage() and changes main()'s indentation to 8-characters.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-02-14 14:41:35 +01:00
Karel Zak def04d475f docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 11:20:36 +01:00
Karel Zak 4799c95f94 include: [c.h]: add fallback for old libs without O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:49:50 +01:00
Karel Zak db9bd703a9 libmount: add fallbacks for old systems without umount2() syscall
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:45:09 +01:00
Karel Zak 067e396b12 include: [at.h]: include c.h for PATH_MAX
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:36:12 +01:00
Karel Zak 4b6cf4859a libmount: replace mkostmps() with more portable mkstemp()
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:18:00 +01:00
Karel Zak 7f7126d749 build-sys: don't build lsblk on Linux without openat()
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 09:42:49 +01:00
Karel Zak d015794e09 partx, lsblk: fix gettext calls
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 09:06:27 +01:00
Karel Zak 69df550fe1 build-sys: release++ (v2.19)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-10 09:37:47 +01:00
Karel Zak 167d959d4c docs: update v2.19 ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-10 09:27:06 +01:00