Commit a052e0b6 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

check return code of asprintf

On ubuntu (gcc 4.9.2), I get:

mount.c: In function ‘add_fsname_auto’:
mount.c:1414:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
   asprintf(&fsauto_names, "%s,%s", old, names);
   ^
cc1: all warnings being treated as errors
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 27026152
......@@ -1411,7 +1411,10 @@ bool add_fsname_auto(const char *names)
fsauto_names = xstrdup(names);
else {
fsauto_names = NULL;
asprintf(&fsauto_names, "%s,%s", old, names);
if (asprintf(&fsauto_names, "%s,%s", old, names) < 0) {
fsauto_names = old;
return false;
}
}
xfree(old);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment