Commit Graph

25 Commits

Author SHA1 Message Date
Rosen Penev ad296391f9
[clang-tidy] fix wrong *cmp usage
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Karel Zak 8ecc6ba807 lib/ismounted: use xstrncpy()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-20 13:03:58 +02:00
Karel Zak e8f7acb0d3 lib: use unique ifdefs for tests
Let's use unique TEST_PROGRAM_<NAME> ifdefs to make build system more
robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-04 11:44:37 +01:00
Stanislav Brabec 74a4705a99 Add sizelimit to internal API
Fully safe checks of loop device need to check sizelimit. To prevent need of two
nearly equal functions, introduce sizelimit parameter to several internal
functions:
loopdev_is_used()
loopdev_find_by_backing_file()
loopcxt_is_used()
loopcxt_find_by_backing_file()

If sizelimit is zero, fall back to the old behavior (ignoring of sizelimit).

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2016-08-03 11:53:28 +02:00
Karel Zak 3fe3f560b7 Revert "include sysmacros.h where used"
This reverts commit 46a40c0184.
2016-03-08 14:26:33 +01:00
Mike Frysinger 46a40c0184 include sysmacros.h where used
BSD/Linux systems stick major/minor/makedev in sysmacros.h.  Newer Linux
libraries have been moving away from including sysmacros.h implicitly via
sys/types.h, so include it directly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-08 14:21:55 +01:00
Ruediger Meier ac1c53e451 lib: fix ismounted includes for FreeBSD
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:32 +01:00
Ruediger Meier 8b9cf26aff lib: fix unused parameters and variables
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 13:40:22 +01:00
Karel Zak d990deac55 lib/ismounted: make it more compatible with lsblk output
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-01 12:09:33 +02:00
Karel Zak f3135f939d lib/ismounted: more robust buffer usage [clang-analyze]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-01 13:51:32 +02:00
Karel Zak b1fa3e2234 lib: use O_CLOEXEC in libcommon
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 16:13:06 +02:00
Sami Kerola f8bd089b1d a pointer should not be compared to zero [coccinelle]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:15 +01:00
Karel Zak 45ddc110ac lib/ismounted: improve loopdev support
... to make it usable for situations when the same backing
file is mapped to more loop devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-19 14:34:01 +01:00
Karel Zak ca4f6229b0 lib/ismounted: basic support for loop devices
# losetup -a /dev/loop0
 /dev/loop0: [2053]:1048578 (/home/fs-images/filesystems/ext2.img)

 # findmnt /dev/loop0
 TARGET    SOURCE     FSTYPE OPTIONS
 /mnt/test /dev/loop0 ext3   rw,relatime,data=ordered

old version:

 ./test_ismounted /home/fs-images/filesystems/ext2.img
 not mounted

new version:

 ./test_ismounted /home/fs-images/filesystems/ext2.img
 mounted on /mnt/test

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-19 12:40:32 +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
Karel Zak 8c9e72ce2b lib: [ismounted] don't wast time with mtab is /proc/mounts used
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24 17:08:26 +01:00
François Revol 9779651e2b portability: fix mntent.h and pty.h usage
Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-07-26 11:43:51 +02:00
Samuel Thibault 4951f9b38f build-sys: minor changes for GNU/Hurd
Here is a patch to fix the build on GNU/Hurd.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-06-14 11:10:02 +02:00
Karel Zak acf6ab6f67 lib: import whole ismounted.c code from e2fsprogs
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-14 01:13:18 +02:00
Theodore Ts'o fdf08588af lib: fix file descriptor leak in is_mounted()
Remove an extraneous fopen() that leaks memory and a file descriptor.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-03 12:50:06 -04:00
Aurelien Jarno 89289f1f25 lib: do not include <linux/fd.h> in ismounted.c
<linux/fd.h> is included for no reason in lib/ismounted.c. This
obviously breaks on non-Linux systems.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-04-20 13:22:21 +02:00
Karel Zak 355eceba7e tests: add fsck:ismounted reg.test
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 16:10:45 +01:00
Karel Zak 33bbc95937 lib: add test_ismounted for regression test
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:43:34 +01:00
Karel Zak fb429f2219 fsck: cosmetic changes (NLS, paths, ...)
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:34:51 +01:00
Karel Zak 607c2a7295 fsck: move fsck from e2fsprogs to util-linux-ng
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:09:34 +01:00