Ignore return value from strerror_r.

It seems like newer glibc added warn_unused_result to this function.
Try harder to ignore the result.
This commit is contained in:
Richard W.M. Jones
2021-04-13 15:40:48 +01:00
parent 2ebacabd68
commit 7ed0da779f
2 changed files with 7 additions and 4 deletions

View File

@@ -67,6 +67,8 @@ let generate_lua_c () =
#endif
#endif
#include \"ignore-value.h\"
#include <guestfs.h>
#include \"guestfs-utils.h\"
@@ -163,7 +165,7 @@ guestfs_int_lua_create (lua_State *L)
g = guestfs_create_flags (flags);
if (!g) {
strerror_r (errno, err, sizeof err);
ignore_value (strerror_r (errno, err, sizeof err));
return luaL_error (L, \"Guestfs.create: cannot create handle: %%s\", err);
}
@@ -242,7 +244,7 @@ error__tostring (lua_State *L)
msg = luaL_checkstring (L, -1);
if (code) {
strerror_r (code, err, sizeof err);
ignore_value (strerror_r (code, err, sizeof err));
lua_pushfstring (L, \"%%s: %%s\", msg, err);
}
else
@@ -653,7 +655,7 @@ get_string_list (lua_State *L, int index)
strs = malloc ((len+1) * sizeof (char *));
if (strs == NULL) {
strerror_r (errno, err, sizeof err);
ignore_value (strerror_r (errno, err, sizeof err));
luaL_error (L, \"get_string_list: malloc failed: %%s\", err);
/*NOTREACHED*/
return NULL;

View File

@@ -47,6 +47,7 @@
#include <libintl.h>
#include "c-ctype.h"
#include "ignore-value.h"
#include "guestfs.h"
#include "guestfs-internal.h"
@@ -329,7 +330,7 @@ guestfs_int_perrorf (guestfs_h *g, const char *fs, ...)
if (err < 0) return;
strerror_r (errnum, buf, sizeof buf);
ignore_value (strerror_r (errnum, buf, sizeof buf));
msg = safe_realloc (g, msg, strlen (msg) + 2 + strlen (buf) + 1);
strcat (msg, ": ");