Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt - dereferencing NULL is generally bad, found by vis...



details:   https://anonhg.NetBSD.org/src/rev/5895661f04c8
branches:  trunk
changeset: 812146:5895661f04c8
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Wed Dec 02 10:19:58 2015 +0000

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

diffstat:

 sbin/gpt/gpt.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 1ddc020c8720 -r 5895661f04c8 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Wed Dec 02 06:05:14 2015 +0000
+++ b/sbin/gpt/gpt.c    Wed Dec 02 10:19:58 2015 +0000
@@ -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 @@
 
 
        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 @@
                                goto close;
                        }
                        gpt->mediasz = gpt->sb.st_size;
+                       gpt->flags |= GPT_NOSYNC;
                }
        }
 



Home | Main Index | Thread Index | Old Index