summaryrefslogtreecommitdiff
path: root/libmount/src
AgeCommit message (Collapse)AuthorFilesLines
2013-05-30libmount: more robust options string parsingKarel Zak1-2/+2
# mount -o=rw /dev/sdb /mnt/test mount: libmount/src/optmap.c:212: mnt_optmap_get_entry: Assertion `namelen' failed. Aborted (core dumped) Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=968786 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-14libmount: use err.h in testKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-14libmount: don't ignore root fs on umount -aKarel Zak1-4/+1
The release v2.22 (the new umount) introduces a regression when root fs is excluded from umount --all. There is not reason for this exception. The libmount should be smart enough to disable mtab update after rootfs umount. Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-09libmount: use MS_SILENT for /{proc,etc}/filesystemsKarel Zak1-1/+3
mount(8) needs to be doing silent mounts when doing this brute forcing or when the filesystem is not explicitly specified. Reported-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-26libmount: (test) check writing to a file was successfulSami Kerola1-1/+4
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26Fix various typosYuri Chornoivan1-1/+1
2013-04-12libmount: add debug message to guess FS functionKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-12libmount: fix mount.nfs segfault, rely on assert() rather than on nonnullKarel Zak10-156/+202
We use mnt_optstr_append_option(&o, mnt_fs_get_vfs_options(fs), NULL); in mount.nfs, unfortunately mnt_optstr_append_option() has been marked ass nonnull(1, 2). That's wrong because append and prepend should robust enough to accept NULL as option name. The patch also removes almost all __attribute__((nonnull). It seems better to rely on assert() to have usable feedback. In many cases (nonnull) is premature optimization for the library. This attribute makes sense for things like strlen() or so... Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=948274 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09libmount, col: remove redundant null checks [smatch scan]Sami Kerola1-4/+2
libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free() text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free() Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09various: fix shadow declarations [smatch scan]Sami Kerola1-4/+4
libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one libmount/src/tab.c:970:26: originally declared here misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one misc-utils/findmnt.c:473:14: originally declared here fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one fdisks/fdiskdoslabel.c:180:20: originally declared here fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:578:16: originally declared here fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one fdisks/fdiskdoslabel.c:924:16: originally declared here [kzak@redhat.com: - don't use local 'tmp' in findmnt.c] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-08Spelling fixes.Ville Skyttä1-2/+2
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2013-04-03libmount: use O_CLOEXECKarel Zak4-10/+10
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-02libmount: add version and features to debug outputKarel Zak1-3/+16
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27libmount: make mnt_table_find_* more robust [coverity scan]Karel Zak1-0/+14
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27libmount: fix __mnt_optstr_append_option() nonull attribute [coverity scan]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27libmount: fix __mnt_cache_find_tag_value() [coverity scan]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-26libmount: fix user-mount by root for mount.<type> helpersKarel Zak1-0/+22
Append options like "exec" "suid" and "dev" to mount.<type> helpers command line if the options are in fstab. This is relevant for root user who calls mount(8) for fstab entries with "user,exec" etc. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-25libmount: add mnt_table_find_mountpoint()Karel Zak5-1/+82
This is more robust implementation of mnt_get_mountpoint() that does not ignore bind mountpoints (mount --bind /mnt /mnt) as it does not depend on st_dev numbers. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-25libmount: make libmount.h consistent with codeKarel Zak1-16/+8
The function with nonnull attribute are silently optimized by gcc so all "if (foo)" are removed if the "foo" is expected as non-null. It make the code less usable and robust in some situations. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-25libmount: umount crashes when trying to umount a non-mountpointKarel Zak3-3/+6
Reported-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-15libmount: clean up header fileKarel Zak2-186/+133
* don't teach people C by header files, so use warn_unused_result attribute only on places where we return allocated memory (to avoid leaks in applications). * merge multiple function attributes to the one list to make it usable with gtk-doc Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-28libmount: ignore name=value if only 'name' is expectedKarel Zak1-1/+21
For example mount /srv/www /mnt -o rw,group=woven,dev,suid the group= should not be interpreted as userspace mount option, because umount(8) expects 'group' (without =<value>). Reported-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26libmount: export umount mountpoint look up codeKarel Zak3-25/+61
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26libmount: don't prepare update for empty mtab/utab on umountKarel Zak1-3/+10
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-26libmount: optimize tab files parsingKarel Zak3-20/+33
- ignore empty files - ignore empty tables Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18libmount: fix a mem leakKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-14libmount: add missing MNT_ERR_AMBIFSKarel Zak1-0/+1
Sorry, the last commit into libmount has been incomplete. Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-13libmount: correctly propagate ambivalent blkid probing resultsKarel Zak3-15/+39
libmount ignores "ambivalent probing result" from libblkid and tries filesystems /etc/filesystems. This is incorrect behavior. Reported-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-11libmount: tags does not start with '/'Karel Zak1-1/+1
References: https://bugzilla.redhat.com/show_bug.cgi?id=909866 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-06textual: fix two misencodings in commentsBenno Schulenberg1-1/+1
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-15libmount: keep MS_PROPAGATION flags in mnt_context_set_mflags() resultKarel Zak1-0/+10
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-15libmount: allow to use propagation flags in fstabKarel Zak6-20/+234
Linux kernel does not allow to change more than one propagation flag by one mount(2) syscall. The flags also cannot be mixed with another mount options. It means that the propagation flags cannot be stored in /etc/fstab, manual "mount --make-* <mountpoint>" is always necessary after successful mount. Painful... This patch implements additional mount(2) after previous successful mount(2) (or exec /sbin/mount.<type>). For example: mount /dev/sda1 /A -o private,unbindable,ro or fstab entry: /dev/sda1 /A auto ro,private,unbindable is implemented by three mount(2) calls: - 1st mounts /dev/sda1 with MS_RDONLY - 2nd sets MS_PRIVATE flag - 3rd sets MS_UNBINDABLE flag. It's the same as as to manually call: mount /dev/sda1 /A -o ro mount --make-private /A mount --make-unbindable /A This solution is not atomic, and umount(2) is not called if propagation flags are not successfully applied, only error is returned. This change does not affect libmount API, so one beautiful day when mount(2) syscall will be improved we can drop this nasty patch. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10libmount: add mnt_fs_get_propagation()Karel Zak3-0/+38
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10libmount: read optional mountinfo fieldsOndrej Oprala5-0/+25
[kzak@redhat.com: - rename struct member and functions from "propagation" to "optional fields" - split the original patch - fix parser] Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-10libmount: fix regression test helperOndrej Oprala1-2/+2
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-09mount: add support for x-mount.mkdir[=<mode>] optionOndrej Oprala1-0/+52
If the target directory (mountpoint) does not exist then mount(8) will create it before mount.<type> is executed or mount(2) syscall is called. Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-09libmount; add recursive mkdirKarel Zak2-0/+54
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12libmount: fix typosKarel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12libmount: make mkstemp() more robust [coverity scan]Karel Zak1-0/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10libmount: don't use safe_getenv() for testKarel Zak1-1/+1
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10libmount: avoid endless loop in mnt_get_kernel_cmdline_optionBernhard Voelker1-3/+1
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>
2012-12-04libmount: clean nonnull attribute usageKarel Zak11-321/+192
- 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>
2012-11-30libmount: add function attributes to private APIOndrej Oprala4-52/+93
Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-30libmount: add function attributes to public APIOndrej Oprala1-243/+584
[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>
2012-11-26libmount: make debug stuff more robustKarel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-26libmount: correctly interpret '*' from /etc/filesystemsKarel Zak2-6/+26
- 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>
2012-11-16libmount: fix support of comma-separated fs types listsGleb Fotengauer-Malinovskiy2-7/+13
# 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>
2012-11-15umount: (recursive) don't call umount(2) for already unmounted targetsKarel Zak1-5/+9
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>
2012-11-15libmount: don't reset NOSWAPMATCH context flagKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-15libmount: don't try to play with loopdevs if umount argument is really ↵Karel Zak1-3/+6
mountpoint Signed-off-by: Karel Zak <kzak@redhat.com>