Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2019 17:44:15 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352085 - stable/12/usr.sbin/makefs
Message-ID:  <201909091744.x89HiF6Z089438@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Mon Sep  9 17:44:14 2019
New Revision: 352085
URL: https://svnweb.freebsd.org/changeset/base/352085

Log:
  MFC r344555 (sobomax): makefs: Improve error handling
  
  Bail out if one of the files scheduled to go to the FS image we are
  making cannot be read (e.g. EPERM).  Previous behaviour of issuing a
  warning but still proceeeding and returning success was definitely not
  correct: masking out error condition as well as making a slighly
  inconsistent FS where attempt to access the file in question ends up in
  EBADF.  (More details in review D18584.)

Modified:
  stable/12/usr.sbin/makefs/ffs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/makefs/ffs.c
==============================================================================
--- stable/12/usr.sbin/makefs/ffs.c	Mon Sep  9 17:43:44 2019	(r352084)
+++ stable/12/usr.sbin/makefs/ffs.c	Mon Sep  9 17:44:14 2019	(r352085)
@@ -932,8 +932,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void *
 	if (isfile) {
 		fbuf = emalloc(ffs_opts->bsize);
 		if ((ffd = open((char *)buf, O_RDONLY, 0444)) == -1) {
-			warn("Can't open `%s' for reading", (char *)buf);
-			goto leave_ffs_write_file;
+			err(EXIT_FAILURE, "Can't open `%s' for reading", (char *)buf);
 		}
 	} else {
 		p = buf;
@@ -987,8 +986,6 @@ ffs_write_file(union dinode *din, uint32_t ino, void *
   
  write_inode_and_leave:
 	ffs_write_inode(&in.i_din, in.i_number, fsopts);
-
- leave_ffs_write_file:
 	if (fbuf)
 		free(fbuf);
 	if (ffd != -1)



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