The branch, master has been updated
via f3db0e8736a lib: Make file_ploadv() static
via f95cb012f6f ctdb: Use file_lines_ploadv()
via d24eb252704 lib: Move file_lines_ploadv() to lib/util/
from 7b5cc7d37f1 lib: Fix memory leak CID#1469247
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f3db0e8736a38de2387b4ea65aafde3b6786e902
Author: Volker Lendecke <[email protected]>
Date: Fri Aug 15 10:09:18 2025 +0200
lib: Make file_ploadv() static
All callers want to see lines.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
Autobuild-User(master): Volker Lendecke <[email protected]>
Autobuild-Date(master): Fri Aug 15 11:53:56 UTC 2025 on atb-devel-224
commit f95cb012f6ffa5ffc8936625daa8fba02e3c9789
Author: Volker Lendecke <[email protected]>
Date: Fri Aug 15 10:07:41 2025 +0200
ctdb: Use file_lines_ploadv()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit d24eb25270494d78246669636ab9c760eeeb9796
Author: Volker Lendecke <[email protected]>
Date: Fri Aug 15 10:04:55 2025 +0200
lib: Move file_lines_ploadv() to lib/util/
Make it available to ctdb
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
ctdb/conf/node.c | 9 +--------
lib/util/util_file.c | 25 ++++++++++++++++++++++++-
lib/util/util_file.h | 7 +++----
source3/lib/sysquotas.c | 2 +-
source3/lib/util_file.c | 24 ------------------------
source3/lib/util_file.h | 3 ---
source3/smbd/dfree.c | 2 +-
7 files changed, 30 insertions(+), 42 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/conf/node.c b/ctdb/conf/node.c
index a242c52dfd6..23dc6314556 100644
--- a/ctdb/conf/node.c
+++ b/ctdb/conf/node.c
@@ -193,21 +193,14 @@ static struct ctdb_node_map
*ctdb_read_nodes_cmd(TALLOC_CTX *mem_ctx,
{
char **lines = NULL;
int nlines;
- char *p;
- size_t size;
struct ctdb_node_map *nodemap = NULL;
char **argl = command_str_to_args(mem_ctx, nodes_cmd);
if (argl == NULL) {
return NULL;
}
- p = file_ploadv(argl, &size);
- if (!p) {
- return NULL;
- }
- lines = file_lines_parse(p, size, &nlines, mem_ctx);
- talloc_free(p);
+ lines = file_lines_ploadv(mem_ctx, argl, &nlines);
if (lines == NULL) {
return NULL;
}
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 46e67f0a4a6..f7bdac4bd84 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -448,7 +448,7 @@ done:
/**
Load from a pipe into memory.
**/
-char *file_ploadv(char * const argl[], size_t *size)
+static char *file_ploadv(char *const argl[], size_t *size)
{
int fd, n;
char *p = NULL;
@@ -491,6 +491,29 @@ char *file_ploadv(char * const argl[], size_t *size)
return p;
}
+/**
+ Load a pipe into memory and return an array of pointers to lines in the data
+ must be freed with TALLOC_FREE.
+**/
+
+char **file_lines_ploadv(TALLOC_CTX *mem_ctx,
+ char *const argl[],
+ int *numlines)
+{
+ char *p = NULL;
+ size_t size;
+ char **ret = NULL;
+
+ p = file_ploadv(argl, &size);
+ if (!p) {
+ return NULL;
+ }
+
+ ret = file_lines_parse(p, size, numlines, mem_ctx);
+ TALLOC_FREE(p);
+ return ret;
+}
+
/*
* fopen a dup'ed fd. Prevent fclose to close the fd passed in.
*
diff --git a/lib/util/util_file.h b/lib/util/util_file.h
index 8de75da5ed1..808ca65abf5 100644
--- a/lib/util/util_file.h
+++ b/lib/util/util_file.h
@@ -72,10 +72,9 @@ _PUBLIC_ int fdprintf(int fd, const char *format, ...)
PRINTF_ATTRIBUTE(2,3);
*/
bool file_compare(const char *path1, const char *path2);
-/*
- load from a pipe into memory.
- */
-char *file_ploadv(char * const argl[], size_t *size);
+char **file_lines_ploadv(TALLOC_CTX *mem_ctx,
+ char *const argl[],
+ int *numlines);
FILE *fdopen_keepfd(int fd, const char *mode);
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index b7eedcd5c12..a984ec559c2 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -19,7 +19,7 @@
#include "includes.h"
-#include "lib/util_file.h"
+#include "lib/util/util_file.h"
#include "lib/util/smb_strtox.h"
#undef DBGC_CLASS
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index 21a6559fc43..3baea15e234 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -165,27 +165,3 @@ int file_ploadv_recv(struct tevent_req *req, TALLOC_CTX
*mem_ctx,
return 0;
}
-
-
-/**
- Load a pipe into memory and return an array of pointers to lines in the data
- must be freed with TALLOC_FREE.
-**/
-
-char **file_lines_ploadv(TALLOC_CTX *mem_ctx,
- char * const argl[],
- int *numlines)
-{
- char *p = NULL;
- size_t size;
- char **ret = NULL;
-
- p = file_ploadv(argl, &size);
- if (!p) {
- return NULL;
- }
-
- ret = file_lines_parse(p, size, numlines, mem_ctx);
- TALLOC_FREE(p);
- return ret;
-}
diff --git a/source3/lib/util_file.h b/source3/lib/util_file.h
index 1aef5a22b44..abaee8c2a7c 100644
--- a/source3/lib/util_file.h
+++ b/source3/lib/util_file.h
@@ -28,8 +28,5 @@ struct tevent_req *file_ploadv_send(TALLOC_CTX *mem_ctx,
char * const argl[], size_t maxsize);
int file_ploadv_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **buf);
-char **file_lines_ploadv(TALLOC_CTX *mem_ctx,
- char * const argl[],
- int *numlines);
#endif
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 89dc11293b5..919cf04286e 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
-#include "lib/util_file.h"
+#include "lib/util/util_file.h"
#include "lib/util/memcache.h"
/****************************************************************************
--
Samba Shared Repository