summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab_update.c
Commit message (Collapse)AuthorAgeFilesLines
* libmount: cleanup licenses sections in the filesKarel Zak2018-08-161-3/+8
| | | | | | | | | * add SPDX-License-Identifier (see https://spdx.org/licenses/) * add "This file part of libmount from util-linux project." * use proper text for LGPL-2.1-or-later * use the same texts everywhere Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: remove %p from debug messagesKarel Zak2018-02-011-2/+2
| | | | | | From libs where suid program may be executed by non-root user. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix access() utab write testKarel Zak2017-11-081-5/+6
| | | | | | | | | | | | | | | | | The commit c08396c7691e1e6a04b6b45892e7e4612ceed8d7 replaces open(O_CREATE) with ecaccess(). Unfortunately, another code depends on the original behavior. * let's make utab when really necessary rather than in the try_write() test * __mnt_new_table_from_file() returns NULL if tab-file does not exists. This is incorrect for tab_update.c stuff. We need empty table in this case. * we can check /run/mount/ directory for write access if eaccess(filename) return ENOENT (because file does not exist) Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: export locking errors as MNT_EX_FILEIOKarel Zak2017-09-151-7/+10
| | | | | | | | | | | | The mount man page assumes locking errors mapped to MNT_EX_FILEIO (16) return code. Unfortunately, this is internally not exported as a special error code, so it's returned as a generic (errno based) stuff. This patch fixes this issue. Note that we still use locking for example for utab or when enabled /etc/mtab (disabled by default). Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: don't support /etc/mtab by defaultKarel Zak2016-04-141-0/+2
| | | | | | | | | | | | | | | | | The file mtab is evil and already unused by mainstream distributions. Now libmount is able to detect mtab->/proc/mounts and use /proc/self/mountinfo if necessary. This heuristic seems overkill in many cases. It's also dangerous on systems where mountinfo is strongly required (systemd based distros). This patch #ifdefs mtab code and forces libmount to always use /proc/self/mountinfo. The new configure option --enable-libmount-support-mtab is necessary to enable old behavior to support mtab. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Fix possible NULL dereference in get_btrfs_fs_root()Karel Zak2016-03-311-2/+7
| | | | | | | | | | | The function mnt_table_get_fs_root() should be robust enough to accept NULL as mountinfo -- the right behaviour is to default to '/'. The set_fs_root() (tab_update.c) has to understand when mountinfo is necessary (for bind mounts and btrfs). Reported-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove assert(arg) from public functionsKarel Zak2015-02-161-14/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use new debug functionsKarel Zak2014-03-211-28/+28
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: update utab after successful extern helper mountKarel Zak2013-11-041-0/+62
| | | | | | | | | | | | | | | This patch allows to maintain private utab libmount file also for external mount/umount helpers that are not linked with libmount. The libmount check if utab has been updated after successful extern helper execution (status=0). If not then the file is updated. This patch affects only 'user' fstab mount option. So, for example with suid mount.cifs you can use: //server/foo /mnt cifs username=foo,noauto,user Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make mnt_table_replace_file() more robust [coverity scan]Karel Zak2013-10-011-1/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counter to libmnt_tableKarel Zak2013-08-211-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add reference counting to libmount_fsKarel Zak2013-08-211-7/+10
| | | | | | | | | | | | | | | | | | | | * mnt_new_fs() returns object with refcount=1 * mnt_free_fs() does not care about reference counter * new functions mnt_ref_fs() and mnt_unref_fs() * mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter * libmmnt_context uses reference counter for internal FS (as it could be shared outside the context) * backwardly incompatible change: - FS could be deallocated after mnt_table_remove_fs() * it's recommended to use mnt_unref_fs() after mnt_table_add_fs() Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix typosOndrej Oprala2013-08-051-13/+13
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: change tailing to trailing in *_tailing_comments functionsOndrej Oprala2013-08-011-4/+4
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: add functions to safely replace a fs tableOndrej Oprala2013-07-031-0/+104
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: add functions to handle comments in fs tablesOndrej Oprala2013-07-031-1/+10
| | | | | | Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mount.nfs segfault, rely on assert() rather than on nonnullKarel Zak2013-04-121-2/+11
| | | | | | | | | | | | | | | | | 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: use O_CLOEXECKarel Zak2013-04-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: clean nonnull attribute usageKarel Zak2012-12-041-0/+2
| | | | | | | | | | - 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: remount does not add entry to mtab fileKarel Zak2012-08-271-12/+15
| | | | | | | | | | | | # mount -n -o ro /dev/sda1 / # mount -o remount,rw /dev/sda1 / For the backward compatibility the command mount(8) should to add a new entry to the file /etc/mtab on remount if the original entry not found (because previous mount has been called with -n). Reported-by: <frinnst> on IRC Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix shadow declarationSami Kerola2012-07-261-1/+1
| | | | | | | libmount/src/tab_update.c:203:8: warning: declaration of 'rc' shadows a previous local [-Wshadow] libmount/src/tab_update.c:159:6: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: don't ignore chmod/own errorsKarel Zak2012-02-021-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix resource leak [coverity scan]Karel Zak2012-01-301-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix leak in tab_update.c testKarel Zak2012-01-261-0/+1
|
* libmount: fix trivial typos in debugging outputPetr Uzel2011-11-091-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: variable dereferenced before check [smatch scan]Karel Zak2011-09-121-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove unnecessary includes, mask API as stableKarel Zak2011-07-251-9/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup docsKarel Zak2011-07-231-6/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mtab update for "none" sourceKarel Zak2011-07-201-11/+13
| | | | | | | | | | | | | tab_parse.c:mnt_parse_mountinfo_line parses "none" in src as NULL, tab_update.c:fprintf_mtab_fs sets m1 to NULL instead of "none" and returns -ENOMEM tab_update.c:update_table says "write entry failed: Success", as errno hasn't been set, and gotos to leave, leaving mtab not updated. Addresses-debian-bug: 634871 Reported-by: Tomas Janousek <tomi@nomi.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use top-level directory for libmount rather than shlibs/mountKarel Zak2011-06-091-0/+860
Signed-off-by: Karel Zak <kzak@redhat.com>