- dereferencing NULL is generally bad, found by visual inspection
- automatically set nosync when opening a file to avoid spurious errors
This commit is contained in:
parent
88c8544847
commit
777094fd12
@ -35,7 +35,7 @@
|
|||||||
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
|
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
|
||||||
#endif
|
#endif
|
||||||
#ifdef __RCSID
|
#ifdef __RCSID
|
||||||
__RCSID("$NetBSD: gpt.c,v 1.54 2015/12/02 04:17:25 christos Exp $");
|
__RCSID("$NetBSD: gpt.c,v 1.55 2015/12/02 10:19:58 jnemeth Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -467,7 +467,7 @@ gpt_open(const char *dev, int flags, int verbose, off_t mediasz, u_int secsz)
|
|||||||
|
|
||||||
|
|
||||||
if ((gpt = calloc(1, sizeof(*gpt))) == NULL) {
|
if ((gpt = calloc(1, sizeof(*gpt))) == NULL) {
|
||||||
if (!(gpt->flags & GPT_QUIET))
|
if (!(flags & GPT_QUIET))
|
||||||
warn("Cannot allocate `%s'", dev);
|
warn("Cannot allocate `%s'", dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -525,6 +525,7 @@ gpt_open(const char *dev, int flags, int verbose, off_t mediasz, u_int secsz)
|
|||||||
goto close;
|
goto close;
|
||||||
}
|
}
|
||||||
gpt->mediasz = gpt->sb.st_size;
|
gpt->mediasz = gpt->sb.st_size;
|
||||||
|
gpt->flags |= GPT_NOSYNC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user