Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Nov 2010 06:17:03 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214618 - stable/8/sbin/mksnap_ffs
Message-ID:  <201011010617.oA16H3ko035198@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Mon Nov  1 06:17:02 2010
New Revision: 214618
URL: http://svn.freebsd.org/changeset/base/214618

Log:
  MFC r213668:
  
  - Print the nmount(2) provided error message only when it is set.
  - Ensure that the error message is NUL-terminated before printing it.
  
  PR:		bin/147482

Modified:
  stable/8/sbin/mksnap_ffs/mksnap_ffs.c
Directory Properties:
  stable/8/sbin/mksnap_ffs/   (props changed)

Modified: stable/8/sbin/mksnap_ffs/mksnap_ffs.c
==============================================================================
--- stable/8/sbin/mksnap_ffs/mksnap_ffs.c	Mon Nov  1 02:22:48 2010	(r214617)
+++ stable/8/sbin/mksnap_ffs/mksnap_ffs.c	Mon Nov  1 06:17:02 2010	(r214618)
@@ -121,8 +121,12 @@ main(int argc, char **argv)
 	build_iovec(&iov, &iovlen, "update", NULL, 0);
 	build_iovec(&iov, &iovlen, "snapshot", NULL, 0);
 
-	if (nmount(iov, iovlen, stfsbuf.f_flags) < 0)
-		err(1, "Cannot create snapshot %s: %s", snapname, errmsg);
+	*errmsg = '\0';
+	if (nmount(iov, iovlen, stfsbuf.f_flags) < 0) {
+		errmsg[sizeof(errmsg) - 1] = '\0';
+		err(1, "Cannot create snapshot %s%s%s", snapname,
+		    *errmsg != '\0' ? ": " : "", errmsg);
+	}
 	if ((fd = open(snapname, O_RDONLY)) < 0)
 		err(1, "Cannot open %s", snapname);
 	if (fstat(fd, &stbuf) != 0)



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