Module Name:    src
Committed By:   jnemeth
Date:           Wed Dec  2 10:19:58 UTC 2015

Modified Files:
        src/sbin/gpt: gpt.c

Log Message:
- dereferencing NULL is generally bad, found by visual inspection
- automatically set nosync when opening a file to avoid spurious errors


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sbin/gpt/gpt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.54 src/sbin/gpt/gpt.c:1.55
--- src/sbin/gpt/gpt.c:1.54	Wed Dec  2 04:17:25 2015
+++ src/sbin/gpt/gpt.c	Wed Dec  2 10:19:58 2015
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #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
 
 #include <sys/param.h>
@@ -467,7 +467,7 @@ gpt_open(const char *dev, int flags, int
 
 
 	if ((gpt = calloc(1, sizeof(*gpt))) == NULL) {
-		if (!(gpt->flags & GPT_QUIET))
+		if (!(flags & GPT_QUIET))
 			warn("Cannot allocate `%s'", dev);
 		return NULL;
 	}
@@ -525,6 +525,7 @@ gpt_open(const char *dev, int flags, int
 				goto close;
 			}
 			gpt->mediasz = gpt->sb.st_size;
+			gpt->flags |= GPT_NOSYNC;
 		}
 	}
 

Reply via email to