summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* cfdisk: data type mismatch, and other, compiler warning fixesSami Kerola2011-01-251-3/+3
| | | | | | | | | | | | | | | | | | Following warnings will longer appear when one will compile with gcc flags -Wall -Wextra -pedantic cfdisk.c:475:3: warning: comparison of unsigned expression < 0 is always false cfdisk.c:487:16: warning: comparison between signed and unsigned integer expressions cfdisk.c:492:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:565:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:569:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:1070:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:1568:5: warning: missing initializer cfdisk.c:1568:5: warning: (near initialization for 'tmp_ext.volume_label') mbsalign.c:131:2: warning: comparison of unsigned expression >= 0 is always true Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: [tt] enlarge output bufferKarel Zak2011-01-251-4/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use WORDS_BIGENDIAN to determine platform byte-orderFabian Groffen2011-01-171-6/+1Star
| | | | | | | | | | | | Autoconf contains the right magic to determine the endianness on many platforms next to Linux. This reverses previous commits to move away from WORDS_BIGENDIAN: "use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN" This is necessary to compile on non Linux platforms like Darwin and Solaris. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* remove duplicate includesKarel Zak2011-01-042-5/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --submounts optionKarel Zak2011-01-041-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix strtosize() testKarel Zak2011-01-032-1/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [env] consolidate safe_getenv() usageKarel Zak2011-01-031-1/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup mangle() usageKarel Zak2011-01-031-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use better format for utab, improve bind mountsKarel Zak2011-01-031-5/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: rewrite mountinfo/fstab parsers to use sscanf()Karel Zak2011-01-031-3/+12
| | | | | | | | The old solution (without scanf()) was based on old code from mount(8). It seems that the modern libc is able to provide all necessary functionality by sscanf() and %ms directive. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix mange() and unmangle() to handle NULLKarel Zak2011-01-031-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add unmangle/mangle() functions to APIKarel Zak2011-01-031-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add wrappers for "at" functionsKarel Zak2011-01-032-1/+102
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt] fix alignment of the last tree childKarel Zak2010-12-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: complete rewriteDavidlohr Bueso2010-12-091-0/+49
| | | | | | Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-301-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] move strmode() from namei.c to strutils.cKarel Zak2010-11-241-0/+40
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt] add TT_FL_RIGHT, add columns list parserKarel Zak2010-11-241-9/+59
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [ismounted] don't wast time with mtab is /proc/mounts usedKarel Zak2010-11-241-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-232-37/+74
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* findmnt: follow HAVE_LANGINFOKarel Zak2010-11-151-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add fallback for nl_langinfo()Karel Zak2010-11-151-0/+121
| | | | | | | | The fallback ignores locales and returns hardcoded static strings. It should be enough to include "nls.h" to work with nl_langinfo() on all systems. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: fix langinfo build breakDavidlohr Bueso2010-11-151-1/+1
| | | | | | | | | | | | | | When HAVE_LANGINFO_H is not defined we break the compilation in tt.c: CC tt.o tt.c: In function ‘tt_new_table’: tt.c:142: warning: implicit declaration of function ‘nl_langinfo’ tt.c:142: error: ‘CODESET’ undeclared (first use in this function) tt.c:142: error: (Each undeclared identifier is reported only once tt.c:142: error: for each function it appears in.) make: *** [tt.o] Error 1 Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib: add test program to canonicalize.cKarel Zak2010-10-252-1/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix syntax error in blkdev.cKarel Zak2010-08-231-1/+1
| | | | | Reported-by: Tuco <tuco.xyz@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* portability: fix mntent.h and pty.h usageFrançois Revol2010-07-261-0/+6
| | | | | Signed-off-by: François Revol <revol@free.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: minor changes for GNU/HurdSamuel Thibault2010-06-142-0/+5
| | | | | | Here is a patch to fix the build on GNU/Hurd. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* lib: remove unwanted debug messagesKarel Zak2010-06-031-8/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: tt.c - fix minimal width of columnKarel Zak2010-06-031-6/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: tt.c: don't print header for empty tableKarel Zak2010-06-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add tt.c (Tree and Table output)Karel Zak2010-06-032-1/+724
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move NR_CPUS determination to lib/cpuset.cKarel Zak2010-06-011-1/+40
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add fallback for libc (uClibc) without CPU_ALLOCKarel Zak2010-06-012-1/+37
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: use libc based cpu_set_tKarel Zak2010-06-011-109/+106Star
| | | | | | | The glibc already supports dynamically allocated CPU sets. We don't have to maintains our private non-compatible implementation. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add cpuset regression testKarel Zak2010-06-012-1/+72
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move bitmap routines to lib/cpuset.cKarel Zak2010-06-011-0/+241
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: support non-ascii characters in inputKarel Zak2010-05-071-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | On Sat, Apr 03, 2010 at 12:58:48PM +0000, Jorge wrote: > When you want to write changes to disk you're asked for a > confirmation, like this one: > > Are you sure you want to write the partition table to disk? (yes > or no) > > There is no problem on the English version, but when you launch the > program in Spanish you get this: > > ¿Está seguro de que desea escribir la tabla de particiones en el > disco? > (sí o no): > > You can't type the "í" character. Trying to do so will end in no > input at all. That is, typing in my keyboard "´" then "i" leads to > nothing. So you can't write changes to disk, and you must launch the > program in English for it to operate. Reported-by: Jorge <yo@jorgesuarezdelis.name> Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/205327 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: revert ugly ENOMEDIUM supportKarel Zak2010-04-271-24/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add strtosize() functionKarel Zak2010-03-302-1/+151
| | | | | | | | | | This function int strtosize(const char *str, uintmax_t *res) supports {K,M,G,T,E,P}iB and {K,M,G,T,E,P}B suffixes. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix blkdev_find_size()Karel Zak2010-03-161-4/+16
| | | | | | | | | | | | | | echo l | fdisk/fdisk /dev/zero FYI that however now spins forever doing: offset=3074457345618258603) at ../lib/blkdev.c:31 at ../lib/blkdev.c:151 at ../lib/blkdev.c:161 Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* cal: factor out and update multibyte alignment codePádraig Brady2010-03-161-0/+254
| | | | | | | | | | | | | * include/mbsalign.h: New module interface * lib/mbsalign.c: Updated implementation synced from coreutils * include/Makefile.am: Add mbsalign.h * misc-utils/Makefile.am: Make cal dependent on mbsalign module * misc-utils/cal.c: Call mbsalign() [kzak@redhat.com: - use min() macro from c.h] Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: avoid compilation failure on rawhideJim Meyering2010-03-161-0/+1
| | | | * lib/blkdev.c: Include <sys/stat.h>, for use of S_ISREG.
* mount: report ambivalent FS detection, improve brute force detectionKarel Zak2010-03-151-9/+24
| | | | | | | | | | | | | | | | | | | The ambivalent probing result should be properly reported and user should be informed that the problem is possible to bypass by "-t <type>" or resolved by wipefs(8). The mount(8) command uses a brute force stage (calls mount(2) for all /{proc,etc}/fylesystems) if there is not any other way how to detect the filesystem type. The brute force stage should not be restricted by libblkid. It's possible that libblkid is not able to detect slightly corrupted filesystem, but kernel is able to mount such filesystem. Note that the brute force stage should not be used if libblkid returns ambivalent probing result. In this case user's intervention is required (e.g. mount -t <type>). Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: use fstat() as fallback in blkdev_get_size()Karel Zak2010-03-111-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add mangle.c for mtab (fstab or swaps) encodingKarel Zak2010-03-102-1/+118
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* liblkid: move getsize.c code to lib/Karel Zak2010-03-101-8/+79
| | | | | | .. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove duplicate #includesKarel Zak2010-02-121-1/+0Star
| | | | | | | | | | | $ make checkincludes fsck/fsck.c: errno.h is included more than once. lib/canonicalize.c: string.h is included more than once. shlibs/blkid/src/blkidP.h: stdio.h is included more than once. shlibs/blkid/src/devname.c: string.h is included more than once. shlibs/blkid/src/devno.c: string.h is included more than once. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: bug (typo) in function MD5Final()Karel Zak2009-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Wed, Dec 09, 2009 at 10:08:38PM +0000, Jochen Voss wrote: > while experimenting with coccinelle, I accidentally found what I > believe is a bug in util-linux-ng release 2.17-rc2 (downloaded > today). The problem is the following code in lib/md5.c (around line > 153): > > void MD5Final(unsigned char digest[16], struct MD5Context *ctx) > { > [...] > memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ > } > > The third argument of memset should probably be the size of 'struct > MD5Context' instead of the size of the pointer. So my guess is > that the memset line should be > > memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ > > instead. I don't know whether this actually causes a problem, > but the comment makes it seem possible that it does. Note, this typo does not have any impact on the utils in the util-linux-ng project, because we don't use MD5 for any security sensitive data or cryptographic stuff. The typo also does not have any impact to the final MD5 hashes. Reported-by: Jochen Voss <voss@seehuhn.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add HAVE_LIBBLKID_INTERNALKarel Zak2009-10-271-4/+4
| | | | | | | It's better to use one macro for all situations where we depends on in-tree (internal) libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: and libblkid: covert /dev/dm-N to /dev/mapper/<name>Karel Zak2009-10-261-4/+44
| | | | | | | | | | | | | * mount(8) uses private device-mapper names in mtab * libblkid returns private device-mapper names when evaluate udev /dev/disk-by symlinks. * on systems where DM is fully integrated with udev the /dev/mapper/<name> files are symlinks to /dev/dm-N. It means we need a special care to hide private device-mapper names. Signed-off-by: Karel Zak <kzak@redhat.com>