Bug 155940 - [libzfs] [patch] zfs list /filesystem does not work.
Summary: [libzfs] [patch] zfs list /filesystem does not work.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pawel Jakub Dawidek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-26 01:00 UTC by KOIE Hidetaka
Modified: 2011-04-12 21:40 UTC (History)
0 users

See Also:


Attachments
file.txt (502 bytes, text/plain)
2011-03-26 01:00 UTC, KOIE Hidetaka
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description KOIE Hidetaka 2011-03-26 01:00:23 UTC
zfs command does not accept abs path to filesystem.

Fix: uninitialized variable is referred.


Patch attached with submission follows:
How-To-Repeat: % zfs list tank
NAME   USED  AVAIL  REFER  MOUNTPOINT
tank   579G   721G  28.0K  /tank
% zfs list /tank
% echo $?
1
%
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-04-09 20:34:06 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-04-12 21:31:42 UTC
Author: pjd
Date: Tue Apr 12 20:31:33 2011
New Revision: 220575
URL: http://svn.freebsd.org/changeset/base/220575

Log:
  Fix 'zfs list <path>' handling. If the path was found, the 'ret' variable was
  uninitialized.
  
  PR:		kern/155940
  Submitted by:	KOIE Hidetaka <koie@suri.co.jp>
  MFC after:	1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c	Tue Apr 12 20:10:15 2011	(r220574)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c	Tue Apr 12 20:31:33 2011	(r220575)
@@ -734,12 +734,13 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl
 	{
 		struct statfs sfs;
 
-		if (statfs(path, &sfs) != 0) {
+		ret = statfs(path, &sfs);
+		if (ret == 0)
+			statfs2mnttab(&sfs, &entry);
+		else {
 			(void) fprintf(stderr, "%s: %s\n", path,
 			    strerror(errno));
-			ret = -1;
 		}
-		statfs2mnttab(&sfs, &entry);
 	}
 #endif	/* sun */
 	if (ret != 0) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Pawel Jakub Dawidek freebsd_committer freebsd_triage 2014-06-01 07:29:33 UTC
State Changed
From-To: open->closed

Fix committed to HEAD, thanks! 


Comment 4 Pawel Jakub Dawidek freebsd_committer freebsd_triage 2014-06-01 07:29:33 UTC
Responsible Changed
From-To: freebsd-fs->pjd

I'll take this one.