Commit Graph

4092 Commits

Author SHA1 Message Date
Karel Zak 7eac65fcf6 libblkid; fix memory leak in blkid_probe_get_wholedisk_probe()
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-21 17:32:01 +01:00
Davidlohr Bueso 212db7f2af prlimit: use xalloc libs
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-20 13:09:32 +01:00
Karel Zak bd6d0d039c losetup: move to sys-utils directory
Now losetup(8) is independent on mount/ stuff at all.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 13:07:54 +01:00
Karel Zak 0a719a7cf6 losetup: remove mount-specific headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 12:52:00 +01:00
Karel Zak de4acb053e losetup: remove unnecessary header files
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 12:36:02 +01:00
Karel Zak 846985f743 losetup: remove 32-bit ioctls
... kernel 2.4 ?! Who cares?

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 12:20:51 +01:00
Karel Zak 6541e717d9 losetup: remove #ifdef LOOP_SET_FD nonsense
It's build-system task to enable/disable utils according to accessible
system features.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 12:13:06 +01:00
Karel Zak 653290586f losetup: remove obsolete #ifdef MAIN
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-20 11:41:24 +01:00
Karel Zak 937266598f libmount: don't use "new" in header file
Reported-by: ben <benscott@nwlink.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-19 22:51:38 +01:00
Francesco Cosoleto 6b310edc5a tests: update fdisk tests
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:10 +01:00
Francesco Cosoleto dae4880508 fdisk: improve some messages
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:10 +01:00
Francesco Cosoleto 8db8295d82 fdisk: Fix bad invalid flag 0x00000 warning message
This splits check_dos_label() and dos_init() off from get_boot() and gets
rid of the invalid flag 0x00000 warning message due to a check for MBR
signs in zeroized buffer:

	memset(MBRbuffer, 0, 512);

	if (what == create_empty_dos)
		goto got_dos_table;
[...]
got_dos_table:
	if (!valid_part_table_flag(MBRbuffer)) {
[...]
	if (!valid_part_table_flag(pe->sectorbuffer))
		fprintf(stderr, _("Warning: invalid flag 0x%04x of partition "
[...]

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:09 +01:00
Francesco Cosoleto 4a96a62a09 fdisk: avoid an intermediate variable in command_prompt()
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:07 +01:00
Francesco Cosoleto b152082db3 fdisk: don't use get_existing_partition() if disk label isn't dos
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:06 +01:00
Francesco Cosoleto 058fdbba0f fdisk: remove unused guess_device_type() function
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:05 +01:00
Francesco Cosoleto ad30333e1d fdisk: get rid of get_boot(create_empty_sun) call
create_sunlabel() should create a new empty SUN disklabel without checking data
itself writes to memory and initialize internal related fdisk variables.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:04 +01:00
Francesco Cosoleto 97a2f1b8ba fdisk: get rid of type_open global variable
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:03 +01:00
Francesco Cosoleto ea4824f1ad fdisk: rename try() and tryprocpt() functions
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:02 +01:00
Francesco Cosoleto e27b42d56f fdisk: drop one parameter from try() function
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:01 +01:00
Francesco Cosoleto 883c5f7158 fdisk: move code for renaming SGI bootfile to SGI module
This moves the code for renaming SGI bootfile from command_prompt() to
sgi_set_bootfilename() function.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:04:00 +01:00
Francesco Cosoleto bd83de2d66 fdisk: remove possibly_osf_label variable that is only assigned
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:03:59 +01:00
Francesco Cosoleto 1025b5ab08 fdisk: remove unused 'require' member in enum action
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 14:03:58 +01:00
Francesco Cosoleto 1a204cd216 agetty: add static and const qualifiers
Remove also a static qualifier in main() function.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 12:49:13 +01:00
Francesco Cosoleto 3b159691ae libblkid: minor docs changes
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 12:49:05 +01:00
Davidlohr Bueso a2f5c22173 wipefs: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-16 12:42:40 +01:00
Davidlohr Bueso 5b9df0280a lists: add list sorting routine
We need a list sorting function, just to mention one example user that could
benefit is the lib/tt code to sort columns.

This patch adds list_sort() which uses the Merge Sort algorithm, behaving
nicely in O(nlog(n)), heavily based on the kernel's implementation[1].  The
private data (void *priv) passed to the comparison function as been removed to
adopt a qsort(3)-like syntax, and IMHO we don't really need it anyways.

[1]: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=lib/list_sort.c;h=d7325c6b103f0be078ff3672c35c468ed35738f1;hb=HEAD

[kzak@redhat.com: - use size_t in list_sort()]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-16 12:37:07 +01:00
Dave Reisner d466c6a1fe findmnt: support alternative location of fstab
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-16 11:29:39 +01:00
Dave Reisner b1b9f1c136 findmnt: use warnx for libmnt error callback
libmount doesn't set errno appropriately here:

$ findmnt -s
findmnt: /etc/fstab: parse error at line 20: Success

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-16 11:27:54 +01:00
Jari Aalto 115bfafafe setterm: order man page items alphabetically
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
2011-12-16 11:25:10 +01:00
Davidlohr Bueso 16fb9b3d11 prlimit: return proper type
The add_prlim() function's definition currently returns a bogus structure.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-12-16 11:20:51 +01:00
Karel Zak aca9b5a6fb docs: add hwclock -c to TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-09 14:08:02 +01:00
Karel Zak 83ae4c2496 partx: don't treat empty partition table as error
Phillip wrote:
 If a partition table was detected, but it had no partitions
 in it, a poorly worded error message was printed and further
 action halted.  For partx -a, this gave an unnecessary error.

Reported-by: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 14:22:04 +01:00
Karel Zak 8275b7326e partx: cleanup usage() and man page, add undocumented --verbose
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 14:14:28 +01:00
Phillip Susi ab025087f9 partx: don't print error when partition already doesn't exist
If you run partx -d to delete partitions, and there are gaps
in the sequence ( partition 2 exists, but 1 doesn't ), then it
would complain that it had errors trying to remove the partitions
that already don't exist. Changed to ignore the error when
errno == ENXIO.

Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
2011-12-08 13:41:39 +01:00
Karel Zak 1593b134eb agetty: don't use log_err() for non-fatal errors
The TIOCSCTTY ioctl requires that caller is session leader -- so it
depends on initd (or we have to add setsid() to aggety). It seems that the
traditional way is to setup tty in agetty and session in login(1).

It means that all session related things (TIOCSCTTY, vhangup, ...) in the
command agetty should be optional. (Note that vhangup() is called when
--hangup is explicitly specified on command line, so log_err() makes
sense there.)

Reported-by: Andrew Walrond <andrew@walrond.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 12:54:49 +01:00
Karel Zak 86248cd28a logger: fix remote logging
Reported-by: Hervé Quillévéré <herve_quillevere@herveq.tk>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 10:20:22 +01:00
Karel Zak 6e7e2c57d5 build-sys: add log_err to smatch non-return functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02 18:31:20 +01:00
Sami Kerola e11a5e6375 build-sys: check HAVE_ definitions with #ifdef [smatch scan]
Fix to `warning: undefined preprocessor identifier' messages.

[kzak@redhat.com: replace "#ifdef XXX #ifdef YYY" with
                  "#if defined(XXX) && defined(YYY)"]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02 18:27:12 +01:00
Sami Kerola fbc333fec0 build-sys: check HAVE_ definitions with #ifdef [smatch scan]
Fix to `warning: undefined preprocessor identifier' messages.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-02 18:21:46 +01:00
Sami Kerola 8a3f94862c build-sys: add missing headers to dist
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-02 18:21:42 +01:00
Karel Zak d2c97887fe libmount: add support for mount -a --fork
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02 18:20:34 +01:00
Karel Zak ede8a60e05 libmount: add "+" prefix for options pattern (e.g findmnt -O)
Examples:

 * findmnt --fstab -O noauto
   Returns all entries where is not "auto" option (including entries
   with "noauto" option.

 * findmnt --fstab -O +noauto
   Returns all entries where is literally "noauto" option.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=758457
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 18:28:42 +01:00
Karel Zak 190c342a83 libmount: add -a to umount(8) sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:47:26 +01:00
Karel Zak 085f163b52 libmount: add mnt_context_umount_next()
This is "umount -a" backend.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:45:53 +01:00
Karel Zak b3f7a0ec3e libmount: improve verbose message
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-01 16:42:42 +01:00
Karel Zak 914c8b7102 Merge branch 'login-utils' of https://github.com/kerolasa/lelux-utiliteetit
* 'login-utils' of https://github.com/kerolasa/lelux-utiliteetit: (23 commits)
  last: fix few compiler warnings
  setpwnam: remove non-ANSI definitions [smatch scan]
  last: possible buffer overflow fixed [smatch scan]
  vipw: fix coding style
  setpwnam: fix coding style
  selinux_utils: fix coding style
  newgrp: fix coding style
  logindefs: fix coding style
  islocal: fix coding style
  chsh: fix coding style
  chfn: fix coding style
  chfn, setpwnam: let config.h be in control of extensions in use
  chfn, chsh: new file pamfail.h for error printing
  chsh: build bug: do not override config.h definition
  chfn, chsh, setpwnam: get true/false from stdbool.h
  login: add version printing option
  newgrp: add version and help options
  vipw: stop printing non-sense version string
  vipw: use libc error printing facilities
  chsh: use libc error printing facilities
  ...
2011-11-29 19:02:42 +01:00
Karel Zak db216e68fa libmount: add new exprimental umount(8)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 19:02:27 +01:00
Karel Zak 732a631126 include,optutils: add option_to_longopt()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 18:21:49 +01:00
Karel Zak e4c92d0617 libmount: use USAGE_* from mount(8) sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-29 18:06:21 +01:00
Sami Kerola 5818a4aa9e last: fix few compiler warnings
Calling abort() as default seems appropriate as the default should be
impossible to reach.

last.c:355:3: warning: switch missing default case [-Wswitch-default]

And simple line removals.

last.c:110:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
last.c:111:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00