summaryrefslogtreecommitdiff
path: root/sbin/mount/mount.c
diff options
context:
space:
mode:
authorMichal Mazurek <akfaew@cvs.openbsd.org>2016-09-04 19:45:28 +0000
committerMichal Mazurek <akfaew@cvs.openbsd.org>2016-09-04 19:45:28 +0000
commit1e53aa15ad0f8f580d88931a34c62a418f41aa06 (patch)
tree38dbb3ff61f3dba515e718f49927774924742c8a /sbin/mount/mount.c
parented59e35c4fbbd12ef51f7efa0bc81027bb7ad040 (diff)
strlen + malloc + snprintf == asprintf
ok martijn@ deraadt@
Diffstat (limited to 'sbin/mount/mount.c')
-rw-r--r--sbin/mount/mount.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 0cfd0f2fa66..018cc7d590d 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.c,v 1.66 2016/06/26 19:53:40 tedu Exp $ */
+/* $OpenBSD: mount.c,v 1.67 2016/09/04 19:45:27 akfaew Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
@@ -685,19 +685,16 @@ maketypelist(char *fslist)
char *
catopt(char *s0, const char *s1)
{
- size_t i;
char *cp;
if (s0 && *s0) {
- i = strlen(s0) + strlen(s1) + 1 + 1;
- if ((cp = malloc(i)) == NULL)
+ if (asprintf(&cp, "%s,%s", s0, s1) == -1)
err(1, NULL);
- (void)snprintf(cp, i, "%s,%s", s0, s1);
} else
cp = strdup(s1);
free(s0);
- return (cp);
+ return cp;
}
void