bin/147482: mksnap_ffs(8) prints garbage as error message when nmount(2) fails

Jaakko Heinonen jh at FreeBSD.org
Mon Sep 6 14:50:05 UTC 2010


The following reply was made to PR bin/147482; it has been noted by GNATS.

From: Jaakko Heinonen <jh at FreeBSD.org>
To: Nicholas Mills <nlmills at g.clemson.edu>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/147482: mksnap_ffs(8) prints garbage as error message when
 nmount(2) fails
Date: Mon, 6 Sep 2010 17:45:48 +0300

 On 2010-06-04, Nicholas Mills wrote:
 > Run "mksnap_ffs /" to get the error message "mksnap_ffs: Cannot create snapshot /: <garbage>: Is a directory".
 
 This patch should fix the problem:
 
 %%%
 Index: sbin/mksnap_ffs/mksnap_ffs.c
 ===================================================================
 --- sbin/mksnap_ffs/mksnap_ffs.c	(revision 212248)
 +++ sbin/mksnap_ffs/mksnap_ffs.c	(working copy)
 @@ -121,8 +121,10 @@ main(int argc, char **argv)
  	build_iovec(&iov, &iovlen, "update", NULL, 0);
  	build_iovec(&iov, &iovlen, "snapshot", NULL, 0);
  
 +	*errmsg = '\0';
  	if (nmount(iov, iovlen, stfsbuf.f_flags) < 0)
 -		err(1, "Cannot create snapshot %s: %s", snapname, errmsg);
 +		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)
 %%%
 
 -- 
 Jaakko


More information about the freebsd-bugs mailing list