return fstype;
mounts = fopen(proc_mounts, "r");
+ if (!mounts)
+ return NULL;
+
while ((nread = getline(&mountstr, &len, mounts)) != -1) {
found = false;
}
if (found)
- strncpy(fstype, tmp, sizeof(fstype));
+ strncpy(fstype, tmp, sizeof(fstype) - 1);
+ fstype[sizeof(fstype) - 1]= '\0';
free(mountstr);
fclose(mounts);