Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 2010 14:50:05 GMT
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/147482: mksnap_ffs(8) prints garbage as error message when nmount(2) fails
Message-ID:  <201009061450.o86Eo5Mu043336@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/147482; it has been noted by GNATS.

From: Jaakko Heinonen <jh@FreeBSD.org>
To: Nicholas Mills <nlmills@g.clemson.edu>
Cc: bug-followup@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



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