tools: fix build warnings

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-09-03 17:29:04 +02:00
parent 12ae2a33c6
commit 09618fb8ab
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
2 changed files with 5 additions and 4 deletions

View File

@ -185,8 +185,9 @@ static int lxc_tool_monitord_spawn(const char *lxcpath)
* synced with the child process. the if-empty-statement
* construct is to quiet the warn-unused-result warning.
*/
if (lxc_read_nointr(pipefd[0], &c, 1))
if (lxc_read_nointr(pipefd[0], &c, 1)) {
;
}
close(pipefd[0]);
@ -207,7 +208,7 @@ static int lxc_tool_monitord_spawn(const char *lxcpath)
close(pipefd[0]);
ret = snprintf(pipefd_str, sizeof(pipefd_str), "%d", pipefd[1]);
if (ret < 0 || ret >= sizeof(pipefd_str)) {
if (ret < 0 || (size_t)ret >= sizeof(pipefd_str)) {
ERROR("Failed to create pid argument to pass to monitord");
_exit(EXIT_FAILURE);
}

View File

@ -149,14 +149,14 @@ static bool lookup_user(const char *oparg, uid_t *uid)
struct passwd pwent;
struct passwd *pwentp = NULL;
char *buf;
size_t bufsize;
ssize_t bufsize;
int ret;
if (!oparg || (oparg[0] == '\0'))
return false;
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
if (bufsize == -1)
if (bufsize < 0)
bufsize = 1024;
buf = malloc(bufsize);