Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2014 17:37:22 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266511 - head/usr.bin/mkimg
Message-ID:  <201405211737.s4LHbM8T021142@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Wed May 21 17:37:22 2014
New Revision: 266511
URL: http://svnweb.freebsd.org/changeset/base/266511

Log:
  Fix CID 1215125: fstat(2) returns -1 on error and sets errno. It does
  not return the error (oops).

Modified:
  head/usr.bin/mkimg/scheme.c

Modified: head/usr.bin/mkimg/scheme.c
==============================================================================
--- head/usr.bin/mkimg/scheme.c	Wed May 21 17:36:12 2014	(r266510)
+++ head/usr.bin/mkimg/scheme.c	Wed May 21 17:37:22 2014	(r266511)
@@ -103,14 +103,12 @@ int
 scheme_bootcode(int fd)
 {
 	struct stat sb;
-	int error;
 
 	if (scheme->bootcode == 0)
 		return (ENXIO);
 
-	error = fstat(fd, &sb);
-	if (error)
-		return (error);
+	if (fstat(fd, &sb) == -1)
+		return (errno);
 	if (sb.st_size > scheme->bootcode)
 		return (EFBIG);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405211737.s4LHbM8T021142>