[PATCH] fix a bug in smbget
Christian Ambach
ambi at samba.org
Thu Feb 4 20:47:57 UTC 2016
Hi Andreas,
Am 28.01.16 um 09:59 schrieb Andreas Schneider:
>> Looks good, I re-attached it with my Reviewed-By: (and a slight chang in
>> the description of the encrypt option) as part of a patchset with more
>> patches that fix up the rcfile parsing and manpages to review so they
>> can finally be pushed together.
>
> Looks good. I've pushed it to autobuild with some minor fixes. Like fixing
> line length in commit messages and in the manpage I changed -U for --update to
> -u.
While working on the blackbox tests I figured that smbget will not work
anymore (at least when compiled with -O3).
Here are two patches that will also need to go into 4.4 to not break the
tool completely in the new release.
In the meanwhile, I'll continue with the writing of the test.
Cheers,
Christian
-------------- next part --------------
>From e84619cfb0fb2c0a38a411a7dbce7a37a176f43a Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 4 Feb 2016 21:38:20 +0100
Subject: [PATCH 1/2] s3:utils/smbget add a error message on allocation error
Signed-off-by: Christian Ambach <ambi at samba.org>
---
source3/utils/smbget.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index 1dd8d77..417ed84 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -585,6 +585,8 @@ static bool smb_download_file(const char *base, const char *name,
readbuf = (char *)SMB_MALLOC(opt.blocksize);
if (!readbuf) {
+ fprintf(stderr, "Failed to allocate %zu bytes for read "
+ "buffer (%s)", opt.blocksize, strerror(errno));
if (localhandle != STDOUT_FILENO) {
close(localhandle);
}
--
1.9.1
>From b3e9a372e03bc81529ab7ec9125fcec15f18fc3e Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 4 Feb 2016 21:39:47 +0100
Subject: [PATCH 2/2] s3:utils/smbget set default blocksize
this got lost in the recent refactorings and causes problems
when smbget attempts to use a zero byte read buffer
Signed-off-by: Christian Ambach <ambi at samba.org>
---
source3/utils/smbget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index 417ed84..91809d1 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -57,7 +57,7 @@ struct opt {
bool update;
int debuglevel;
};
-static struct opt opt;
+static struct opt opt = { .blocksize = SMB_DEFAULT_BLOCKSIZE };
static bool smb_download_file(const char *base, const char *name,
bool recursive, bool resume, bool toplevel,
--
1.9.1
More information about the samba-technical
mailing list