Skip to content

Commit

Permalink
mount: address a couple crashes
Browse files Browse the repository at this point in the history
Change-Id: I3f978f40eb77d7679decf4a33b5c655ebb74d979
  • Loading branch information
invisiblek authored and Flinny committed Apr 12, 2015
1 parent 3c2e6a9 commit b476e41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions util-linux/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -1790,13 +1790,12 @@ static int singlemount(struct mntent *mp, int ignore_busy)
// Treat fstype "auto" as unspecified
if (mp->mnt_type && !strcmp(mp->mnt_type, "auto"))
mp->mnt_type = NULL;
} else {
} else if (mp->mnt_type) {
// If user didn't specify an fstype and blkid disagrees or the
// fstype is "auto", trust blkid's determination of the fstype.

detected_fstype = get_fstype_from_devname(mp->mnt_fsname);

if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
if (!strcmp(mp->mnt_type, "auto") ||
(detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
mp->mnt_type = detected_fstype;
}
Expand Down
2 changes: 1 addition & 1 deletion util-linux/volume_id/get_devname.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ char *get_fstype_from_devname(const char *device)
add_to_uuid_cache(device);
uc = uuidcache_init(0);

return (char*)uc->type;
return (uc != NULL ? (char*)uc->type : NULL);
#else
return NULL;
#endif
Expand Down

0 comments on commit b476e41

Please sign in to comment.