Source-Changes-HG archive

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

[src/trunk]: src/sbin/resize_ffs Use `!= -1' instead of `== 0' out of paranoia.



details:   https://anonhg.NetBSD.org/src/rev/75bd1fd0f95f
branches:  trunk
changeset: 336971:75bd1fd0f95f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 28 17:25:33 2015 +0000

description:
Use `!= -1' instead of `== 0' out of paranoia.

diffstat:

 sbin/resize_ffs/resize_ffs.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 2cea940b1b82 -r 75bd1fd0f95f sbin/resize_ffs/resize_ffs.c
--- a/sbin/resize_ffs/resize_ffs.c      Sat Mar 28 17:23:42 2015 +0000
+++ b/sbin/resize_ffs/resize_ffs.c      Sat Mar 28 17:25:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: resize_ffs.c,v 1.39 2015/03/28 17:22:46 riastradh Exp $        */
+/*     $NetBSD: resize_ffs.c,v 1.40 2015/03/28 17:25:33 riastradh Exp $        */
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: resize_ffs.c,v 1.39 2015/03/28 17:22:46 riastradh Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.40 2015/03/28 17:25:33 riastradh Exp $");
 
 #include <sys/disk.h>
 #include <sys/disklabel.h>
@@ -2030,16 +2030,16 @@
        size_t ptn;
 
        /* Get info about partition/wedge */
-       if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == 0)
+       if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1)
                return dkw.dkw_size;
-       if (ioctl(fd, DIOCGDINFO, &lp) == 0) {
+       if (ioctl(fd, DIOCGDINFO, &lp) != -1) {
                ptn = strchr(dev_name, '\0')[-1] - 'a';
                if (ptn >= lp.d_npartitions)
                        return 0;
                pp = &lp.d_partitions[ptn];
                return pp->p_size;
        }
-       if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode))
+       if (fstat(fd, &st) != -1 && S_ISREG(st.st_mode))
                return st.st_size;
 
        return 0;



Home | Main Index | Thread Index | Old Index