summaryrefslogtreecommitdiffstats
path: root/libmount/src/optstr.c
Commit message (Collapse)AuthorAgeFilesLines
* libmount: remove assert(arg) from public functionsKarel Zak2015-02-161-23/+13Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use new debug functionsKarel Zak2014-03-211-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Set each optstr's to NULL if failedNamhyung Kim2013-09-261-3/+9
| | | | | | | | When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's are freed but not reset. It can lead to double frees at the end of mnt_fs_{ap,pre}pend_options(). Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* libmount: fix typosOndrej Oprala2013-08-051-48/+48
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: more robust options string parsingKarel Zak2013-05-301-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>
* libmount: fix mount.nfs segfault, rely on assert() rather than on nonnullKarel Zak2013-04-121-3/+23
| | | | | | | | | | | | | | | | | 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>
* libmount: fix __mnt_optstr_append_option() nonull attribute [coverity scan]Karel Zak2013-03-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: ignore name=value if only 'name' is expectedKarel Zak2013-02-281-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>
* libmount: clean nonnull attribute usageKarel Zak2012-12-041-2/+4
| | | | | | | | | | - 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>
* libmount: add mnt_optstr_deduplicate_option()Karel Zak2012-08-011-0/+61
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve ifdef HAVE_LIBSELINUX stuffKarel Zak2012-06-191-2/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2012wk23' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak2012-06-151-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * '2012wk23' of git://github.com/kerolasa/lelux-utiliteetit: lsblk: use blkdev_scsi_type_to_name() blkdev: add blkdev_scsi_type_to_name() wipefs: use symbolic value for markup mode eject: inform if CD-ROM drive is not ready docs: clean up partx.8 manual include: fix void pointer arithmetics warnings sysfs: fix printf format warnings build: fix unused parameter warnings build: fix redundant redeclaration warnings include: fix spurious list.h warnings uuidd: use output redirection which works [checkbashisms] blkid: fix realloc memory leak [cppcheck] setarch: do not use -1 as array index [cppcheck]
| * build: fix unused parameter warningsSami Kerola2012-06-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pager.c:203:14: warning: unused parameter 'argc' [-Wunused-parameter] pager.c:203:26: warning: unused parameter 'argv' [-Wunused-parameter] randutils.c:108:14: warning: unused parameter 'argc' [-Wunused-parameter] randutils.c:108:26: warning: unused parameter 'argv' [-Wunused-parameter] optstr.c:774:37: warning: unused parameter 'optstr' [-Wunused-parameter] optstr.c:774:51: warning: unused parameter 'value' [-Wunused-parameter] optstr.c:774:65: warning: unused parameter 'valsz' [-Wunused-parameter] optstr.c:774:79: warning: unused parameter 'next' [-Wunused-parameter] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | libmount: make some string operations more robustKarel Zak2012-06-151-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: fix read before allocated bufferPetr Uzel2012-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux .... ==21359== Invalid read of size 1 ==21359== at 0x415AC6: mnt_optstr_remove_option_at (optstr.c:310) ==21359== by 0x416358: mnt_optstr_apply_flags (optstr.c:716) ==21359== by 0x40DFBF: mnt_context_prepare_mount (context_mount.c:86) ==21359== by 0x40EB5A: mnt_context_mount (context_mount.c:782) ==21359== by 0x4058B0: main (mount.c:918) ==21359== Address 0x51cd5bf is 1 bytes before a block of size 10 alloc'd ==21359== at 0x4C297CD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==21359== by 0x4C29957: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==21359== by 0x415780: __mnt_optstr_append_option (optstr.c:188) ==21359== by 0x412822: mnt_fs_append_options (fs.c:764) ==21359== by 0x409288: mnt_context_append_options (context.c:733) ==21359== by 0x4053F0: main (mount.c:776) Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* | libmount: don't use nosuid,noexec,nodev for cifs user=fooKarel Zak2012-06-141-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux is incorrectly translated to mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ... The command mount(8) should be sensitive to "user" (without "=<name>") only. The correct cifs command line is: mount.cifs -o user=root,password=linux Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157 Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: don't generate empty option stringsKarel Zak2012-06-141-1/+3
|/ | | | | | | | | | | | mount -t foo something /mnt/test -o user=root,password=linux generates "rw,noexec,nosuid,nodev,password=linux,,user=root" options string for /sbin/mount.foo, the ",," is incorrect. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: trim leading commas from each options stringDave Reisner2012-06-051-0/+5
| | | | | | | | | | | Fixes a bug in option string parsing wherein a line such as: ro,relatime,,nosuid,nodev Will be seen as only the tokens "ro" and "relatime" after the parser encounters a zero length (and erroneously declared NULL) option. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* libmount: cleanup docsKarel Zak2012-02-221-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix buffer overflow and leaks in testsKarel Zak2012-01-261-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix compiler warnings [-Wsign-compare]Karel Zak2012-01-171-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: ignore "defaults" mount optionKarel Zak2012-01-171-1/+3
| | | | | | ... thanks to regression test! Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix MS_BIND|MS_REC usage, improve some bitwise operationsKarel Zak2012-01-161-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to toggle ro/rw and mount againKarel Zak2012-01-131-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix trivial typos in debugging outputPetr Uzel2011-11-091-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: remove unnecessary includes, mask API as stableKarel Zak2011-07-251-7/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: clean up docsKarel Zak2011-07-251-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup docsKarel Zak2011-07-231-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add support for mount -aKarel Zak2011-06-231-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use top-level directory for libmount rather than shlibs/mountKarel Zak2011-06-091-0/+1224
Signed-off-by: Karel Zak <kzak@redhat.com>