[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Mon Dec 8 22:38:02 MST 2014
The branch, master has been updated
via 9bb0728 notify_inotify: Simplify inotify_dispatch
via 658ffb1 smbd: Compile notify_inotify only if available
via a5a5326 notify_inotify: inotify_watch now takes a mem_ctx
via de4a1c9 notify: Add "dir" to notify_event
via f530d6d notify_inotify: Make inotify_watch return 0/errno
via 9b47445 notify_inotify: Slightly simplify watch_destructor
via 01a1678 notify_inotify: Slightly simplify inotify_watch
via eb10a36 notify_inotify: Make inotify_setup return 0/errno
via 608774d notify_inotify: Add a NULL check
via 18b6822 notify_inotify: Simplify filter_match
via 8a49485 smbd: Move lp_parm_bool out of notify_inotify.c
via dc38f64 lib: Use iov_buf in unix_msg
via d775c38 lib: Simplify iov_buf[len]
via 3a6a6f1 messaging3: Avoid self-send complexity
via e2ee1a4 lib: Fix blank line endings
via 4debc30 lib: Fix a typo
from 5ebb190 s3:locking: Change the data model for leases_db to cope with dynamic path renames.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9bb0728f7c71cf72e31ac15c74912479a803f323
Author: Volker Lendecke <vl at samba.org>
Date: Thu Dec 4 16:01:17 2014 +0000
notify_inotify: Simplify inotify_dispatch
Normally, I'm trying to simplify things with early returns. But in
this case I think the reverse makes the if-condition easier to
understand
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Dec 9 06:37:24 CET 2014 on sn-devel-104
commit 658ffb19826b3cfde323c3e16fde4f713e88ffd8
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 18 11:28:20 2014 +0000
smbd: Compile notify_inotify only if available
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit a5a5326152a090e737201612f5e29a7ecc457c85
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 5 12:18:31 2014 +0000
notify_inotify: inotify_watch now takes a mem_ctx
This will make it easier to integrate into proper memory hierarchies.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit de4a1c90a70b31f99e987fa109683862bd0823d1
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 5 11:44:42 2014 +0000
notify: Add "dir" to notify_event
"notify_event" only reports names relative to some path that is only
implicitly known via "private_data". Right now "private_data" is the fsp
of the directory holding this notify. I want to use inotify_watch in a
notify-daemon that does not have a fsp available and has more problems
getting the path right out of "private_data". notify_inotify has the
directory under which the event happened available, so make it known to
the callback. Right now no caller uses it yet.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit f530d6d97bfb7c64ede37ad8d2ee33118ddcf3d1
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 13:26:35 2014 +0000
notify_inotify: Make inotify_watch return 0/errno
More like a cleanup, but I want to use inotify_watch in notifyd
that I would like to keep as light as possible
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9b474456b8133bd82c14cd097a6df2380b55b423
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 13:20:15 2014 +0000
notify_inotify: Slightly simplify watch_destructor
Another case of an early return
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 01a167818d0d927dc9190e4c4b196a701110207e
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 13:15:12 2014 +0000
notify_inotify: Slightly simplify inotify_watch
tallocing first avoids having to call inotify_rm_watch
This even fixes a real error: We share inotifies between different instances,
so the rm_watch in the error paths destroys other legitimate watches
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit eb10a36a96f5b4da4ab4677761b8dab7ceeec7b0
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 13:09:44 2014 +0000
notify_inotify: Make inotify_setup return 0/errno
This gets rid of one NT_STATUS_HAVE_NO_MEMORY with its implicit return; :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 608774d8c4a14863d1e603d0b2f0dac94e8f69a7
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 13:07:03 2014 +0000
notify_inotify: Add a NULL check
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 18b682250457e60ae75d4352c7f0b88686eb1dd8
Author: Volker Lendecke <vl at samba.org>
Date: Sun Oct 26 09:13:41 2014 +0000
notify_inotify: Simplify filter_match
Early returns make code simpler
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8a4948593840db0823c8f7c0ba4b60f7e07c3340
Author: Volker Lendecke <vl at samba.org>
Date: Mon Oct 27 10:26:46 2014 +0000
smbd: Move lp_parm_bool out of notify_inotify.c
Notifyd should be as independent of Samba infrastructure as possible,
and it will call notify_inotify
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit dc38f646af4582a3adffda20d7bb0e449df5e22e
Author: Volker Lendecke <vl at samba.org>
Date: Sat Dec 6 11:28:16 2014 +0100
lib: Use iov_buf in unix_msg
Now that iov_buf does not pull in talloc we can use it
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d775c386e498d4c2062f8fc65f515f991d127dc1
Author: Volker Lendecke <vl at samba.org>
Date: Sat Dec 6 11:22:35 2014 +0100
lib: Simplify iov_buf[len]
This makes iov_buf independent of talloc
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 3a6a6f19410606a9028861ca95ac80d2651e2830
Author: Volker Lendecke <vl at samba.org>
Date: Thu Nov 13 10:38:40 2014 +0000
messaging3: Avoid self-send complexity
With the notify code I've hit another case where self-sends caused
a problem. This time messages were lost because we tried to do
multiple dispatch_rec calls from within a single inotify callback.
Only the first one was being taken care of, the others did not find
receivers.
This patch makes self-sends go through the kernel as well, the
kernel queues everything nicely for us. With dgram messaging this
should be pretty fast. If it turns out to be a performance problem,
we can solve it later by doing proper queueing in user space. We
need to completely decouple any processing from callbacks.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit e2ee1a42cf5b57e09604792f46dd173182a014e5
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 7 14:13:51 2014 +0100
lib: Fix blank line endings
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 4debc30117a33fca1cc2667869cc6718afd62bbe
Author: Volker Lendecke <vl at samba.org>
Date: Sun Dec 7 14:09:29 2014 +0100
lib: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/util/charset/iconv.c | 70 +++++------
lib/util/idtree.c | 16 +--
lib/util/util_file.c | 26 ++--
librpc/idl/notify.idl | 1 +
source3/lib/iov_buf.c | 46 +++----
source3/lib/iov_buf.h | 4 +-
source3/lib/messages.c | 113 +----------------
source3/lib/messages_ctdbd.c | 11 +-
source3/lib/unix_msg/unix_msg.c | 25 +---
source3/lib/unix_msg/wscript_build | 2 +-
source3/modules/vfs_default.c | 19 ++-
source3/smbd/notify_inotify.c | 184 +++++++++++++++-------------
source3/smbd/notify_internal.c | 10 +-
source3/smbd/proto.h | 19 +--
source3/torture/test_messaging_fd_passing.c | 2 +-
source3/torture/test_messaging_read.c | 2 +-
source3/wscript_build | 10 +-
source4/ntvfs/common/notify.c | 1 +
source4/ntvfs/sysdep/inotify.c | 2 +
19 files changed, 235 insertions(+), 328 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c
index c5b45fe..bf561f2 100644
--- a/lib/util/charset/iconv.c
+++ b/lib/util/charset/iconv.c
@@ -1,19 +1,19 @@
-/*
+/*
Unix SMB/CIFS implementation.
minimal iconv implementation
Copyright (C) Andrew Tridgell 2001
Copyright (C) Jelmer Vernooij 2002
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -80,7 +80,7 @@ static const struct charset_functions builtin_functions[] = {
{"ASCII", ascii_pull, ascii_push},
{"646", ascii_pull, ascii_push},
{"ISO-8859-1", latin1_pull, latin1_push},
-#ifdef DEVELOPER
+#ifdef DEVELOPER
{"WEIRD", weird_pull, weird_push, true},
#endif
#ifdef DARWINOS
@@ -94,12 +94,12 @@ static const struct charset_functions builtin_functions[] = {
/* if there was an error then reset the internal state,
this ensures that we don't have a shift state remaining for
character sets like SJIS */
-static size_t sys_iconv(void *cd,
+static size_t sys_iconv(void *cd,
const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
- size_t ret = iconv((iconv_t)cd,
- discard_const_p(char *, inbuf), inbytesleft,
+ size_t ret = iconv((iconv_t)cd,
+ discard_const_p(char *, inbuf), inbytesleft,
outbuf, outbytesleft);
if (ret == (size_t)-1) iconv(cd, NULL, NULL, NULL, NULL);
return ret;
@@ -112,13 +112,13 @@ static size_t sys_iconv(void *cd,
* It only knows about a very small number of character sets - just
* enough that Samba works on systems that don't have iconv.
**/
-_PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
+_PUBLIC_ size_t smb_iconv(smb_iconv_t cd,
const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
/* in many cases we can go direct */
if (cd->direct) {
- return cd->direct(cd->cd_direct,
+ return cd->direct(cd->cd_direct,
inbuf, inbytesleft, outbuf, outbytesleft);
}
@@ -189,7 +189,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
int i;
ret = (smb_iconv_t)talloc_named(mem_ctx,
- sizeof(*ret),
+ sizeof(*ret),
"iconv(%s,%s)", tocode, fromcode);
if (!ret) {
errno = ENOMEM;
@@ -211,7 +211,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
from = &builtin_functions[i];
}
}
- if (strcasecmp(tocode, builtin_functions[i].name) == 0) {
+ if (strcasecmp(tocode, builtin_functions[i].name) == 0) {
if (use_builtin_handlers || builtin_functions[i].samba_internal_charset) {
to = &builtin_functions[i];
}
@@ -219,7 +219,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
}
#ifdef HAVE_NATIVE_ICONV
- /* the from and to varaibles indicate a samba module or
+ /* the from and to variables indicate a samba module or
* internal conversion, ret->pull and ret->push are
* initialised only in this block for iconv based
* conversions */
@@ -232,7 +232,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
ret->pull = sys_iconv;
}
}
-
+
if (to == NULL) {
ret->cd_push = iconv_open(tocode, "UTF-16LE");
if (ret->cd_push == (iconv_t)-1)
@@ -246,7 +246,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
if (ret->pull == NULL && from == NULL) {
goto failed;
}
-
+
if (ret->push == NULL && to == NULL) {
goto failed;
}
@@ -340,7 +340,7 @@ static size_t ascii_pull(void *cd, const char **inbuf, size_t *inbytesleft,
errno = E2BIG;
return -1;
}
-
+
return 0;
}
@@ -379,7 +379,7 @@ static size_t ascii_push(void *cd, const char **inbuf, size_t *inbytesleft,
errno = E2BIG;
return -1;
}
-
+
return ir_count;
}
@@ -469,7 +469,7 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
errno = EINVAL;
return -1;
}
-
+
if (sscanf(&(*inbuf)[1], "%04x", &v) != 1) {
errno = EILSEQ;
return -1;
@@ -487,7 +487,7 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
errno = E2BIG;
return -1;
}
-
+
return 0;
}
@@ -497,7 +497,7 @@ static size_t ucs2hex_push(void *cd, const char **inbuf, size_t *inbytesleft,
while (*inbytesleft >= 2 && *outbytesleft >= 1) {
char buf[6];
- if ((*inbuf)[1] == 0 &&
+ if ((*inbuf)[1] == 0 &&
((*inbuf)[0] & 0x80) == 0 &&
(*inbuf)[0] != '@') {
(*outbuf)[0] = (*inbuf)[0];
@@ -528,7 +528,7 @@ static size_t ucs2hex_push(void *cd, const char **inbuf, size_t *inbytesleft,
errno = E2BIG;
return -1;
}
-
+
return 0;
}
@@ -618,7 +618,7 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft,
if ((c[0] & 0xf0) == 0xe0) {
if (in_left < 3 ||
- (c[1] & 0xc0) != 0x80 ||
+ (c[1] & 0xc0) != 0x80 ||
(c[2] & 0xc0) != 0x80) {
errno = EILSEQ;
goto error;
@@ -635,15 +635,15 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft,
if ((c[0] & 0xf8) == 0xf0) {
unsigned int codepoint;
if (in_left < 4 ||
- (c[1] & 0xc0) != 0x80 ||
+ (c[1] & 0xc0) != 0x80 ||
(c[2] & 0xc0) != 0x80 ||
(c[3] & 0xc0) != 0x80) {
errno = EILSEQ;
goto error;
}
- codepoint =
- (c[3]&0x3f) |
- ((c[2]&0x3f)<<6) |
+ codepoint =
+ (c[3]&0x3f) |
+ ((c[2]&0x3f)<<6) |
((c[1]&0x3f)<<12) |
((c[0]&0x7)<<18);
if (codepoint < 0x10000) {
@@ -758,7 +758,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
c[0] = 0xe0 | (codepoint >> 12);
c[1] = 0x80 | ((codepoint >> 6) & 0x3f);
c[2] = 0x80 | (codepoint & 0x3f);
-
+
in_left -= 2;
out_left -= 3;
uc += 2;
@@ -775,9 +775,9 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
errno = EILSEQ;
goto error;
}
- codepoint = 0x10000 + (uc[2] | ((uc[3] & 0x3)<<8) |
+ codepoint = 0x10000 + (uc[2] | ((uc[3] & 0x3)<<8) |
(uc[0]<<10) | ((uc[1] & 0x3)<<18));
-
+
if (out_left < 4) {
errno = E2BIG;
goto error;
@@ -786,7 +786,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
c[1] = 0x80 | ((codepoint >> 12) & 0x3f);
c[2] = 0x80 | ((codepoint >> 6) & 0x3f);
c[3] = 0x80 | (codepoint & 0x3f);
-
+
in_left -= 4;
out_left -= 4;
uc += 4;
@@ -807,7 +807,7 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
*outbytesleft = out_left;
*inbuf = (const char *)uc;
*outbuf = (char *)c;
-
+
return 0;
error:
@@ -853,7 +853,7 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
unsigned int codepoint2;
if (in_left < 4) {
codepoint = 0xfffd;
- goto codepoint16;
+ goto codepoint16;
}
codepoint2 = uc[2] | (uc[3]<<8);
if ((codepoint2 & 0xfc00) != 0xdc00) {
@@ -883,12 +883,12 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
codepoint16:
c[0] = codepoint & 0xFF;
c[1] = (codepoint>>8) & 0xFF;
-
+
in_left -= 2;
out_left -= 2;
uc += 2;
c += 2;
- continue;
+ continue;
}
if (in_left == 1) {
@@ -905,7 +905,7 @@ static size_t utf16_munged_pull(void *cd, const char **inbuf, size_t *inbyteslef
*outbytesleft = out_left;
*inbuf = (const char *)uc;
*outbuf = (char *)c;
-
+
return 0;
error:
diff --git a/lib/util/idtree.c b/lib/util/idtree.c
index 6f1a4ac..0056c09 100644
--- a/lib/util/idtree.c
+++ b/lib/util/idtree.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
very efficient functions to manage mapping a id (such as a fnum) to
@@ -6,20 +6,20 @@
Copyright (C) Andrew Tridgell 2004
- This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
+ This code is derived from lib/idr.c in the 2.6 Linux kernel, which was
written by Jim Houston jim.houston at ccur.com, and is
Copyright (C) 2002 by Concurrent Computer Corporation
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -53,7 +53,7 @@
#define set_bit(bit, v) (v) |= (1<<(bit))
#define clear_bit(bit, v) (v) &= ~(1<<(bit))
#define test_bit(bit, v) ((v) & (1<<(bit)))
-
+
struct idr_layer {
uint32_t bitmap;
struct idr_layer *ary[IDR_SIZE];
@@ -195,7 +195,7 @@ static int idr_get_new_above_int(struct idr_context *idp, void *ptr, int startin
int layers, v, id;
idr_pre_get(idp);
-
+
id = starting_id;
build_up:
p = idp->top;
@@ -309,7 +309,7 @@ static int _idr_remove(struct idr_context *idp, int id)
return -1;
}
- if ( idp->top && idp->top->count == 1 &&
+ if ( idp->top && idp->top->count == 1 &&
(idp->layers > 1) &&
idp->top->ary[0]) {
/* We can drop a layer */
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 886bcae..83c746b 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -4,17 +4,17 @@
* Copyright (C) Andrew Tridgell 1992-1998 Modified by Jeremy Allison 1995.
*
* Added afdgets() Jelmer Vernooij 2005
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -32,7 +32,7 @@
*/
/**
-read a line from a file with possible \ continuation chars.
+read a line from a file with possible \ continuation chars.
Blanks at the start or end of a line are stripped.
The string will be allocated if s2 is NULL
**/
@@ -78,7 +78,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
}
return(s);
case EOF:
- if (len <= 0 && !s2)
+ if (len <= 0 && !s2)
SAFE_FREE(s);
return(len>0?s:NULL);
case ' ':
@@ -93,7 +93,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
if (!s2 && len > maxlen-3)
{
char *t;
-
+
maxlen *= 2;
t = realloc_p(s, char, maxlen);
if (!t) {
@@ -107,7 +107,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
}
/**
- * Read one line (data until next newline or eof) and allocate it
+ * Read one line (data until next newline or eof) and allocate it
*/
_PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint)
{
@@ -200,7 +200,7 @@ _PUBLIC_ char *file_load(const char *fname, size_t *size, size_t maxsize, TALLOC
char *p;
if (!fname || !*fname) return NULL;
-
+
fd = open(fname,O_RDONLY);
if (fd == -1) return NULL;
@@ -256,7 +256,7 @@ bool unmap_file(void *start, size_t size)
#ifdef HAVE_MMAP
if (munmap( start, size ) != 0) {
DEBUG( 1, ("map_file: Failed to unmap address %p "
- "of size %u - %s\n",
+ "of size %u - %s\n",
start, (unsigned int)size, strerror(errno) ));
return false;
}
@@ -286,10 +286,10 @@ char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx
if (!ret) {
talloc_free(p);
return NULL;
- }
-
+ }
+
talloc_steal(ret, p);
-
+
memset(ret, 0, sizeof(ret[0])*(i+2));
ret[0] = p;
@@ -315,7 +315,7 @@ char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx
/**
load a file into memory and return an array of pointers to lines in the file
-must be freed with talloc_free().
+must be freed with talloc_free().
**/
_PUBLIC_ char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx)
{
diff --git a/librpc/idl/notify.idl b/librpc/idl/notify.idl
index ec81e8c..66422ec 100644
--- a/librpc/idl/notify.idl
+++ b/librpc/idl/notify.idl
@@ -65,6 +65,7 @@ interface notify
/* structure sent between servers in notify messages */
typedef [public] struct {
uint32 action;
+ utf8string dir;
utf8string path;
pointer private_data;
} notify_event;
diff --git a/source3/lib/iov_buf.c b/source3/lib/iov_buf.c
index dd99da3..e05dfc9 100644
--- a/source3/lib/iov_buf.c
+++ b/source3/lib/iov_buf.c
@@ -23,43 +23,33 @@
ssize_t iov_buflen(const struct iovec *iov, int iovcnt)
{
- size_t buflen = 0;
+ return iov_buf(iov, iovcnt, NULL, 0);
+}
+
+ssize_t iov_buf(const struct iovec *iov, int iovcnt,
+ uint8_t *buf, size_t buflen)
+{
+ size_t needed = 0;
+ uint8_t *p = buf;
int i;
for (i=0; i<iovcnt; i++) {
size_t thislen = iov[i].iov_len;
- size_t tmp = buflen + thislen;
+ size_t tmp;
+
+ tmp = needed + thislen;
- if ((tmp < buflen) || (tmp < thislen)) {
+ if ((tmp < needed) || (tmp < thislen)) {
/* overflow */
return -1;
}
- buflen = tmp;
- }
- return buflen;
-}
-
-uint8_t *iov_buf(TALLOC_CTX *mem_ctx, const struct iovec *iov, int iovcnt)
-{
- int i;
- ssize_t buflen;
- uint8_t *buf, *p;
+ needed = tmp;
- buflen = iov_buflen(iov, iovcnt);
- if (buflen == -1) {
- return NULL;
- }
- buf = talloc_array(mem_ctx, uint8_t, buflen);
- if (buf == NULL) {
- return NULL;
+ if (needed <= buflen) {
+ memcpy(p, iov[i].iov_base, thislen);
+ p += thislen;
+ }
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list