]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: util: Remove file_pload()
authorJeremy Allison <jra@samba.org>
Sat, 18 May 2019 18:14:53 +0000 (11:14 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 13 Jun 2019 10:22:07 +0000 (10:22 +0000)
No longer used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13964

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit c5729ae44219ec81008040d4d50f0f5fdf254201)

lib/util/samba_util.h
lib/util/util_file.c

index a4817f40ad9f4999cc8cde79cce28851849ba71d..48417a38e0f9ee51413e7c5eb7492c41513cb7be 100644 (file)
@@ -397,7 +397,6 @@ bool file_compare(const char *path1, const char *path2);
 /*
   load from a pipe into memory.
  */
-char *file_pload(const char *syscmd, size_t *size);
 char *file_ploadv(char * const argl[], size_t *size);
 
 /* The following definitions come from lib/util/util.c  */
index af709dc52d0d716583d8057c0b5f8571d03937d8..102eac46131e7971287c0bc8886f14afa2ee3220 100644 (file)
@@ -365,52 +365,6 @@ bool file_compare(const char *path1, const char *path2)
        return true;
 }
 
-
-/**
- Load from a pipe into memory.
-**/
-char *file_pload(const char *syscmd, size_t *size)
-{
-       int fd, n;
-       char *p;
-       char buf[1024];
-       size_t total;
-
-       fd = sys_popen(syscmd);
-       if (fd == -1) {
-               return NULL;
-       }
-
-       p = NULL;
-       total = 0;
-
-       while ((n = sys_read(fd, buf, sizeof(buf))) > 0) {
-               p = talloc_realloc(NULL, p, char, total + n + 1);
-               if (!p) {
-                       DEBUG(0,("file_pload: failed to expand buffer!\n"));
-                       close(fd);
-                       return NULL;
-               }
-               memcpy(p+total, buf, n);
-               total += n;
-       }
-
-       if (p) {
-               p[total] = 0;
-       }
-
-       /* FIXME: Perhaps ought to check that the command completed
-        * successfully (returned 0); if not the data may be
-        * truncated. */
-       sys_pclose(fd);
-
-       if (size) {
-               *size = total;
-       }
-
-       return p;
-}
-
 /**
  Load from a pipe into memory.
 **/