summaryrefslogtreecommitdiffstats
path: root/libmount/src/version.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/version.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/version.c')
-rw-r--r--libmount/src/version.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libmount/src/version.c b/libmount/src/version.c
index 00e4f9961..00b7c03e7 100644
--- a/libmount/src/version.c
+++ b/libmount/src/version.c
@@ -25,6 +25,9 @@ static const char *lib_features[] = {
#ifdef CONFIG_LIBMOUNT_DEBUG
"debug",
#endif
+#ifdef CONFIG_LIBMOUNT_ASSERT
+ "assert",
+#endif
NULL
};
@@ -39,6 +42,8 @@ int mnt_parse_version_string(const char *ver_string)
const char *cp;
int version = 0;
+ assert(ver_string);
+
for (cp = ver_string; *cp; cp++) {
if (*cp == '.')
continue;