__do_free char *buf = NULL;
struct passwd pwent;
struct passwd *pwentp = NULL;
- size_t bufsize;
+ ssize_t bufsize;
int ret;
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (bufsize == -1)
+ if (bufsize < 0)
bufsize = 1024;
buf = malloc(bufsize);
int ret, i;
struct group grent;
struct group *grentp = NULL;
- size_t bufsize;
+ ssize_t bufsize;
ngroups = getgroups(0, NULL);
if (ngroups < 0) {
}
bufsize = sysconf(_SC_GETGR_R_SIZE_MAX);
- if (bufsize == -1)
+ if (bufsize < 0)
bufsize = 1024;
buf = malloc(bufsize);
size_t length = 0;
int ret;
size_t slen;
+ ssize_t nbytes;
char *owner;
char nicname[IFNAMSIZ];
struct alloted_s *n;
return NULL;
}
- if (lxc_pwrite_nointr(fd, newline, slen, length) != slen) {
+ nbytes = lxc_pwrite_nointr(fd, newline, slen, length);
+ if (nbytes < 0 || (size_t)nbytes != slen) {
CMD_SYSERROR("Failed to append new entry \"%s\" to database file", newline);
if (lxc_netdev_delete_by_name(nicname) != 0)
static int find_default_map(void)
{
__do_free char *buf = NULL;
- size_t bufsize;
+ ssize_t bufsize;
struct passwd pwent;
int ret = -1;
struct passwd *pwentp = NULL;
bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (bufsize == -1)
+ if (bufsize < 0)
bufsize = 1024;
buf = malloc(bufsize);
return 0;
}
-static bool is_in_ns_range(long id, struct id_map *map)
+static bool is_in_ns_range(unsigned long id, struct id_map *map)
{
if (id < map->nsid)
return false;
+
if (id >= map->nsid + map->range)
return false;
+
return true;
}