From 3cf31a194f5721b67b1255e3f168d4bc87d433fc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 15 Feb 2000 19:36:47 +0000 Subject: Added replacement functions sys_popen and sys_pclose. These are based on the glibc source code and are safer than the traditional popen as they don't use a shell to exec the requested command. Now we have these functions they can be tightened up (environment etc.) as required to make a safe popen. It should now be safe to add the environement variable loading code to loadparm.c Jeremy. (This used to be commit b52e92b09d4ca3b66e534f520468dee27065d048) --- source3/printing/print_svid.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source3/printing/print_svid.c') diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index ffc059f9f9..9891e158a2 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -47,10 +47,9 @@ static printer_t *printers = NULL; static void populate_printers(void) { -#ifdef HAVE_POPEN FILE *fp; - if ((fp = popen("/usr/bin/lpstat -v", "r")) != NULL) { + if ((fp = sys_popen("/usr/bin/lpstat -v", "r")) != NULL) { char buf[BUFSIZ]; while (fgets(buf, sizeof (buf), fp) != NULL) { @@ -88,13 +87,10 @@ static void populate_printers(void) DEBUG(0,("populate_printers: malloc fail for ptmp\n")); } } - pclose(fp); + sys_pclose(fp); } else { DEBUG(0,( "Unable to run lpstat!\n")); } -#else - DEBUG(0,( "No popen() defined: Unable to run lpstat!\n")); -#endif } -- cgit