lib: util: Remove file_pload()
authorJeremy Allison <jra@samba.org>
Sat, 18 May 2019 18:14:53 +0000 (11:14 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 24 May 2019 19:00:05 +0000 (19:00 +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>
lib/util/samba_util.h
lib/util/util_file.c

index cf8602e2015934010634e0778cd42b040733ab4b..f0aa42e7271f4fb3974c2f4e59a45fbb8d6e3903 100644 (file)
@@ -404,7 +404,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 1541a08f93590c4b2a9b3d2f6802bfbaa7512c98..792761530153e1a9fa8ca25938615eaa48965871 100644 (file)
@@ -398,52 +398,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.
 **/