return 0;
/* skip the first line, which contains column headings */
- if (!fgets(line, MAXPATHLEN, f))
+ if (!fgets(line, MAXPATHLEN, f)) {
+ fclose(f);
return 0;
+ }
while (fgets(line, MAXPATHLEN, f)) {
c = strchr(line, '\t');
output = malloc(LXC_LOG_BUFFER_SIZE);
if (!output) {
ERROR("failed to allocate memory for script output");
+ pclose(f);
return -1;
}
if (errno != ENXIO) {
WARN("unexpected error for ioctl on '%s': %m",
direntp->d_name);
+ close(fd);
continue;
}
listentry->elem = strdup(mountpoint);
if (!listentry->elem) {
SYSERROR("strdup failed");
+ free(listentry);
return -1;
}
lxc_list_add_tail(mountlist, listentry);
if (strcmp(p+1, "/") == 0) {
// this is '/'. is it shared?
p = index(p2+1, ' ');
- if (strstr(p, "shared:"))
+ if (strstr(p, "shared:")) {
+ fclose(f);
return 1;
+ }
}
}
fclose(f);