svn commit: r196799 - head/usr.sbin/diskinfo

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu Sep 3 22:19:10 UTC 2009


Author: pjd
Date: Thu Sep  3 22:19:09 2009
New Revision: 196799
URL: http://svn.freebsd.org/changeset/base/196799

Log:
  Don't bother obtaining the ident if we are not going to print it.

Modified:
  head/usr.sbin/diskinfo/diskinfo.c

Modified: head/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- head/usr.sbin/diskinfo/diskinfo.c	Thu Sep  3 22:00:42 2009	(r196798)
+++ head/usr.sbin/diskinfo/diskinfo.c	Thu Sep  3 22:19:09 2009	(r196799)
@@ -104,9 +104,6 @@ main(int argc, char **argv)
 		error = ioctl(fd, DIOCGFWHEADS, &fwheads);
 		if (error)
 			fwheads = 0;
-		error = ioctl(fd, DIOCGIDENT, ident);
-		if (error)
-			ident[0] = '\0';
 		if (!opt_v) {
 			printf("%s", argv[i]);
 			printf("\t%u", sectorsize);
@@ -133,7 +130,7 @@ main(int argc, char **argv)
 				printf("\t%-12u\t# Heads according to firmware.\n", fwheads);
 				printf("\t%-12u\t# Sectors according to firmware.\n", fwsectors);
 			} 
-			if (ident[0] != '\0')
+			if (ioctl(fd, DIOCGIDENT, ident) == 0)
 				printf("\t%-12s\t# Disk ident.\n", ident);
 		}
 		printf("\n");


More information about the svn-src-head mailing list