summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-27 17:37:15 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-28 10:04:47 +0200
commita64262697afb85f8db5872238c51b9499114ee58 (patch)
tree769ca48cc67bb174fba585721f4d55c5730ad27b /source4
parent67b2c424cefbecfe8581044703ba178c61c0ece1 (diff)
downloadsamba-a64262697afb85f8db5872238c51b9499114ee58.tar.gz
samba-a64262697afb85f8db5872238c51b9499114ee58.tar.xz
samba-a64262697afb85f8db5872238c51b9499114ee58.zip
s4:smbd/pidfile.c - fix "asprintf" calls
Diffstat (limited to 'source4')
-rw-r--r--source4/smbd/pidfile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c
index da3f363ff9b..de93a0390ce 100644
--- a/source4/smbd/pidfile.c
+++ b/source4/smbd/pidfile.c
@@ -38,7 +38,9 @@ pid_t pidfile_pid(const char *piddir, const char *name)
pid_t ret;
char *pidFile;
- asprintf(&pidFile, "%s/%s.pid", piddir, name);
+ if (asprintf(&pidFile, "%s/%s.pid", piddir, name) < 0) {
+ return 0;
+ }
fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
@@ -85,7 +87,10 @@ void pidfile_create(const char *piddir, const char *name)
char *pidFile;
pid_t pid;
- asprintf(&pidFile, "%s/%s.pid", piddir, name);
+ if (asprintf(&pidFile, "%s/%s.pid", piddir, name) < 0) {
+ DEBUG(0,("ERROR: Out of memory\n"));
+ exit(1);
+ }
pid = pidfile_pid(piddir, name);
if (pid != 0) {