summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-26 16:57:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:58 -0500
commit49839f356f493d0de1b719c8c3bfdee4713c0728 (patch)
tree62055f766b1dea0f06a623e8454d22994dd500f2 /source4/lib
parentf801ad359290c51d3216c755fb2a8344babb484f (diff)
downloadsamba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.gz
samba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.bz2
samba-49839f356f493d0de1b719c8c3bfdee4713c0728.zip
r10513: Reduce some use of pstring. The main reason some parts of the code still
use pstring is next_token() now. (This used to be commit a5b88bcd420eb7ae42283293541519e142be36e3)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/cmdline/popt_common.h1
-rw-r--r--source4/lib/pidfile.c13
2 files changed, 8 insertions, 6 deletions
diff --git a/source4/lib/cmdline/popt_common.h b/source4/lib/cmdline/popt_common.h
index 28676de56b..785a50ae70 100644
--- a/source4/lib/cmdline/popt_common.h
+++ b/source4/lib/cmdline/popt_common.h
@@ -22,7 +22,6 @@
#define _POPT_COMMON_H
#include "popt.h"
-#include "pstring.h"
/* Common popt structures */
extern struct poptOption popt_common_samba[];
diff --git a/source4/lib/pidfile.c b/source4/lib/pidfile.c
index b1866ee6af..54d2c81d2e 100644
--- a/source4/lib/pidfile.c
+++ b/source4/lib/pidfile.c
@@ -21,7 +21,6 @@
*/
#include "includes.h"
-#include "pstring.h"
#include "system/filesys.h"
#ifndef O_NONBLOCK
@@ -35,11 +34,13 @@ pid_t pidfile_pid(const char *name)
int fd;
char pidstr[20];
uint_t ret;
- pstring pidFile;
+ char *pidFile;
- slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
+ asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name);
fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
+ SAFE_FREE(pidFile);
+
if (fd == -1) {
return 0;
}
@@ -75,10 +76,10 @@ void pidfile_create(const char *name)
{
int fd;
char buf[20];
- pstring pidFile;
+ char *pidFile;
pid_t pid;
- slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
+ asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name);
pid = pidfile_pid(name);
if (pid != 0) {
@@ -107,5 +108,7 @@ void pidfile_create(const char *name)
pidFile, strerror(errno)));
exit(1);
}
+
/* Leave pid file open & locked for the duration... */
+ SAFE_FREE(pidFile);
}