Module Name: src Committed By: dyoung Date: Thu Jul 16 23:50:32 UTC 2009
Modified Files: src/sbin/fsck: partutil.c Log Message: Callers expect getdiskinfo() to return -1 on error, so do that. Simplify getdiskinfo() a bit while I am here: don't save error codes that we will never refer to again. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck/partutil.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/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.8 src/sbin/fsck/partutil.c:1.9 --- src/sbin/fsck/partutil.c:1.8 Sun Jun 14 21:06:18 2009 +++ src/sbin/fsck/partutil.c Thu Jul 16 23:50:32 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $ */ +/* $NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: partutil.c,v 1.8 2009/06/14 21:06:18 haad Exp $"); +__RCSID("$NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $"); #include <sys/types.h> #include <sys/disklabel.h> @@ -155,10 +155,7 @@ struct disklabel lab; struct disklabel *lp = &lab; prop_dictionary_t disk_dict, geom_dict; - int error; - error = 0; - if (dt) { lp = getdiskbyname(dt); if (lp == NULL) @@ -166,17 +163,16 @@ } /* Get disk description dictionary */ - if ((error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, - &disk_dict)) != 0) { + if (prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, &disk_dict)) { /* * Ask for disklabel if DIOCGDISKINFO failed. This is * compatibility call and can be removed when all devices * will support DIOCGDISKINFO. * cgd, ccd pseudo disk drives doesn't support DIOCGDDISKINFO */ - if ((error = ioctl(fd, DIOCGDINFO, lp)) == -1) { + if (ioctl(fd, DIOCGDINFO, lp) == -1) { printf("DIOCGDINFO on %s failed\n", s); - return (errno); + return -1; } label2geom(geo, lp); } else {