[PATCH] Do not ignore the block size of the dfree command - brc #11403

Ralph Böhme rb at sernet.de
Fri Jul 17 10:37:12 UTC 2015


On Fri, Jul 17, 2015 at 12:33:43PM +0200, Ralph Böhme wrote:
> On Fri, Jul 17, 2015 at 11:45:15AM +0200, Andreas Schneider wrote:
> > On Friday 17 July 2015 09:54:38 Andreas Schneider wrote:
> > > Hi,
> > > 
> > > attached find a patch to fix
> > > https://bugzilla.samba.org/show_bug.cgi?id=11403
> > 
> > New version with a simple test for the dfree command.
> 
> two issues:
> 
> - the global declaration of dfree_broken must be removed
> 
> - imo the error code path in the case (lines == NULL) could be
>   simplified
> 
> Fixups attached.

now they are.

-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
From 5fb4d31d5b0dee5692d4eaef7d5dad687dc2d001 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Fri, 17 Jul 2015 12:10:19 +0200
Subject: [PATCH 1/2] FIXUP 1b170fa: simplify error code path

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/smbd/dfree.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 0b89a29..32a3a69 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -84,7 +84,7 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path,
 		DEBUG (3, ("disk_free: Running command '%s'\n", syscmd));
 
 		lines = file_lines_pload(syscmd, NULL);
-		if (lines) {
+		if (lines != NULL) {
 			char *line = lines[0];
 
 			DEBUG (3, ("Read input from dfree, \"%s\"\n", line));
@@ -108,18 +108,12 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path,
 				*dsize = 2048;
 			if (!*dfree)
 				*dfree = 1024;
-		} else {
-			DEBUG (0, ("disk_free: file_lines_load() failed for "
-				   "command '%s'. Error was : %s\n",
-				   syscmd, strerror(errno) ));
-			if (sys_fsusage(path, dfree, dsize) != 0) {
-				DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
-					strerror(errno) ));
-				return (uint64_t)-1;
-			}
-		}
 
-		goto dfree_done;
+			goto dfree_done;
+		}
+		DEBUG (0, ("disk_free: file_lines_load() failed for "
+			   "command '%s'. Error was : %s\n",
+			   syscmd, strerror(errno) ));
 	}
 
 	if (sys_fsusage(path, dfree, dsize) != 0) {
-- 
2.1.0


From dc3a0982052e31eba996b8c0c49897f67c3a6224 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Fri, 17 Jul 2015 12:30:13 +0200
Subject: [PATCH 2/2] FIXUP e0b3c2e: also remove declaration

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/smbd/globals.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 2ca23aa..35a3ee9 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -30,8 +30,6 @@ struct smbd_dmapi_context;
 extern struct smbd_dmapi_context *dmapi_ctx;
 #endif
 
-extern bool dfree_broken;
-
 /* how many write cache buffers have been allocated */
 extern unsigned int allocated_write_caches;
 
-- 
2.1.0



More information about the samba-technical mailing list