summaryrefslogtreecommitdiffstats
path: root/libmount/src/lock.c
diff options
context:
space:
mode:
authorKarel Zak2013-04-12 12:35:34 +0200
committerKarel Zak2013-04-12 12:35:34 +0200
commit4569bbeab783632c81ee14793da84b3e29444543 (patch)
treeb165e3f418600bef11edbd962bc7f76b9d95113f /libmount/src/lock.c
parentbuild-sys: release++ (v2.23-rc2) (diff)
downloadkernel-qcow2-util-linux-4569bbeab783632c81ee14793da84b3e29444543.tar.gz
kernel-qcow2-util-linux-4569bbeab783632c81ee14793da84b3e29444543.tar.xz
kernel-qcow2-util-linux-4569bbeab783632c81ee14793da84b3e29444543.zip
libmount: fix mount.nfs segfault, rely on assert() rather than on nonnull
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>
Diffstat (limited to 'libmount/src/lock.c')
-rw-r--r--libmount/src/lock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libmount/src/lock.c b/libmount/src/lock.c
index 9e583cc06..e73edf54b 100644
--- a/libmount/src/lock.c
+++ b/libmount/src/lock.c
@@ -53,6 +53,8 @@ struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id)
char *lo = NULL, *ln = NULL;
size_t losz;
+ assert(datafile);
+
/* for flock we use "foo.lock, for mtab "foo~"
*/
losz = strlen(datafile) + sizeof(".lock");