nspawn: make coverity happy
authorTom Gundersen <teg@jklm.no>
Mon, 25 May 2015 20:27:14 +0000 (22:27 +0200)
committerTom Gundersen <teg@jklm.no>
Mon, 25 May 2015 20:27:29 +0000 (22:27 +0200)
Rather than checking the return of asprintf() we are checking if buf gets allocated,
make it clear that it is ok to ignore the return value.

Fixes CID 1299644.

src/nspawn/nspawn.c

index 646edea..a0eece6 100644 (file)
@@ -1026,9 +1026,9 @@ static int tmpfs_patch_options(const char *options, char **ret) {
         if (arg_userns && arg_uid_shift != 0) {
 
                 if (options)
-                        asprintf(&buf, "%s,uid=" UID_FMT ",gid=" UID_FMT, options, arg_uid_shift, arg_uid_shift);
+                        (void) asprintf(&buf, "%s,uid=" UID_FMT ",gid=" UID_FMT, options, arg_uid_shift, arg_uid_shift);
                 else
-                        asprintf(&buf, "uid=" UID_FMT ",gid=" UID_FMT, arg_uid_shift, arg_uid_shift);
+                        (void) asprintf(&buf, "uid=" UID_FMT ",gid=" UID_FMT, arg_uid_shift, arg_uid_shift);
                 if (!buf)
                         return -ENOMEM;