From e02b05b5658fa50e6f94e604fc518a624211b6de Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 14 Mar 1998 13:00:09 +0000 Subject: new files to support starting/stopping the server (This used to be commit 087981009d57006ff80a0cf50891d4473f86f1bb) --- source3/lib/pidfile.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 source3/lib/pidfile.c (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c new file mode 100644 index 0000000000..8dee7421de --- /dev/null +++ b/source3/lib/pidfile.c @@ -0,0 +1,88 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + pidfile handling + Copyright (C) Andrew Tridgell 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + + +extern int DEBUGLEVEL; + +#ifndef O_NONBLOCK +#define O_NONBLOCK +#endif + + +/* create a pid file in the lock directory. open it and leave it locked */ +void pidfile_create(char *name) +{ + int fd; + char buf[20]; + pstring pidFile; + + sprintf(pidFile, "%s/%s.pid", lp_lockdir(), name); + + fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY | O_TRUNC, 0644); + if (fd < 0) { + DEBUG(0,("ERROR: can't open %s: %s\n", pidFile, + strerror(errno))); + exit(1); + } + + if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) { + DEBUG(0,("ERROR: %s is already running\n", name)); + exit(1); + } + + sprintf(buf, "%u\n", (unsigned int) getpid()); + if (write(fd, buf, strlen(buf)) < 0) { + DEBUG(0,("ERROR: can't write to %s: %s\n", + pidFile, strerror(errno))); + exit(1); + } + /* Leave pid file open & locked for the duration... */ +} + + +/* return the pid in a pidfile. return 0 if the process (or pidfile) + does not exist */ +int pidfile_pid(char *name) +{ + FILE *f; + pstring pidFile; + unsigned ret; + + sprintf(pidFile, "%s/%s.pid", lp_lockdir(), name); + + f = fopen(pidFile, "r"); + if (!f) { + return 0; + } + + if (fscanf(f,"%u", &ret) != 1) { + fclose(f); + return 0; + } + fclose(f); + + if (!process_exists(ret)) return 0; + + return ret; +} + -- cgit From d360320618fe3a7f53ac1f05ee3ac54323a03c82 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 15 Mar 1998 02:37:52 +0000 Subject: - added the ability to kill off individual connections from SWAT (from the status page) - split the claim_connection() code into its own file - fixed the claim_connection() code to lock the file when manipulating it - always claim a null connection at startup - fixed a bug in the pidfile code (This used to be commit abd4a17e21d12be3d1747e94ceb1915abaf135e3) --- source3/lib/pidfile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 8dee7421de..6cad1436eb 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -35,10 +35,17 @@ void pidfile_create(char *name) int fd; char buf[20]; pstring pidFile; + int pid; sprintf(pidFile, "%s/%s.pid", lp_lockdir(), name); - fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY | O_TRUNC, 0644); + pid = pidfile_pid(name); + if (pid > 0 && process_exists(pid)) { + DEBUG(0,("ERROR: %s is already running\n", name)); + exit(1); + } + + fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY, 0644); if (fd < 0) { DEBUG(0,("ERROR: can't open %s: %s\n", pidFile, strerror(errno))); @@ -50,8 +57,9 @@ void pidfile_create(char *name) exit(1); } + memset(buf, 0, sizeof(buf)); sprintf(buf, "%u\n", (unsigned int) getpid()); - if (write(fd, buf, strlen(buf)) < 0) { + if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { DEBUG(0,("ERROR: can't write to %s: %s\n", pidFile, strerror(errno))); exit(1); -- cgit From 3dfc0c847240ac7e12c39f4ed9c31a888949ade1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 May 1998 06:38:36 +0000 Subject: changed to use slprintf() instead of sprintf() just about everywhere. I've implemented slprintf() as a bounds checked sprintf() using mprotect() and a non-writeable page. This should prevent any sprintf based security holes. (This used to be commit ee09e9dadb69aaba5a751dd20ccc6d587d841bd6) --- source3/lib/pidfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 6cad1436eb..46d6a9d5b8 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -37,7 +37,7 @@ void pidfile_create(char *name) pstring pidFile; int pid; - sprintf(pidFile, "%s/%s.pid", lp_lockdir(), name); + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); pid = pidfile_pid(name); if (pid > 0 && process_exists(pid)) { @@ -76,7 +76,7 @@ int pidfile_pid(char *name) pstring pidFile; unsigned ret; - sprintf(pidFile, "%s/%s.pid", lp_lockdir(), name); + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); f = fopen(pidFile, "r"); if (!f) { -- cgit From f888868f46a5418bac9ab528497136c152895305 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 May 1998 00:55:32 +0000 Subject: This is a security audit change of the main source. It removed all ocurrences of the following functions : sprintf strcpy strcat The replacements are slprintf, safe_strcpy and safe_strcat. It should not be possible to use code in Samba that uses sprintf, strcpy or strcat, only the safe_equivalents. Once Andrew has fixed the slprintf implementation then this code will be moved back to the 1.9.18 code stream. Jeremy. (This used to be commit 2d774454005f0b54e5684cf618da7060594dfcbb) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 46d6a9d5b8..9cb3f5afef 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -58,7 +58,7 @@ void pidfile_create(char *name) } memset(buf, 0, sizeof(buf)); - sprintf(buf, "%u\n", (unsigned int) getpid()); + slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) getpid()); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { DEBUG(0,("ERROR: can't write to %s: %s\n", pidFile, strerror(errno))); -- cgit From efc2732f55c909a2d6228be2185a69c3569f7c97 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Jul 1998 23:57:56 +0000 Subject: Fix for pidfile startup message. Jeremy. (This used to be commit 108284cc28d44ffea028209cf28b746008bdf455) --- source3/lib/pidfile.c | 69 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 9cb3f5afef..fecc759da9 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -28,6 +28,31 @@ extern int DEBUGLEVEL; #define O_NONBLOCK #endif +/* return the pid in a pidfile. return 0 if the process (or pidfile) + does not exist */ +int pidfile_pid(char *name) +{ + FILE *f; + unsigned ret; + pstring pidFile; + + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); + + f = fopen(pidFile, "r"); + if (!f) { + return 0; + } + + if (fscanf(f,"%u", &ret) != 1) { + fclose(f); + return 0; + } + fclose(f); + + if (!process_exists(ret)) return 0; + + return ret; +} /* create a pid file in the lock directory. open it and leave it locked */ void pidfile_create(char *name) @@ -40,57 +65,31 @@ void pidfile_create(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); pid = pidfile_pid(name); - if (pid > 0 && process_exists(pid)) { - DEBUG(0,("ERROR: %s is already running\n", name)); - exit(1); - } + if (pid > 0 && process_exists(pid)) { + DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", + name, pidFile, pid)); + exit(1); + } fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY, 0644); if (fd < 0) { - DEBUG(0,("ERROR: can't open %s: %s\n", pidFile, + DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile, strerror(errno))); exit(1); } if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) { - DEBUG(0,("ERROR: %s is already running\n", name)); + DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n", + name, pidFile, strerror(errno))); exit(1); } memset(buf, 0, sizeof(buf)); slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) getpid()); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - DEBUG(0,("ERROR: can't write to %s: %s\n", + DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile, strerror(errno))); exit(1); } /* Leave pid file open & locked for the duration... */ } - - -/* return the pid in a pidfile. return 0 if the process (or pidfile) - does not exist */ -int pidfile_pid(char *name) -{ - FILE *f; - pstring pidFile; - unsigned ret; - - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - - f = fopen(pidFile, "r"); - if (!f) { - return 0; - } - - if (fscanf(f,"%u", &ret) != 1) { - fclose(f); - return 0; - } - fclose(f); - - if (!process_exists(ret)) return 0; - - return ret; -} - -- cgit From 623a18db4b0f46c80c29e93a0ad0a2fcbfec71dc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Sep 1998 00:23:28 +0000 Subject: More 64 bit stuff - now the fcntl locks are 64 bit clean. Nearly at the stage where I can expose the 64-bit-ness to the NT clients.... Jeremy. (This used to be commit 422f1dd45074c0e28203aca5952e57bbe56676b6) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index fecc759da9..b8c782f3d6 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -78,7 +78,7 @@ void pidfile_create(char *name) exit(1); } - if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) { + if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)==False) { DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n", name, pidFile, strerror(errno))); exit(1); -- cgit From cf3a9741dc7427efb97eff09a3c197a906ce6767 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Sep 1998 21:43:48 +0000 Subject: Changes to test in configure if capabilities are enabled on a system. Changes to get Samba to compile cleanly with the IRIX compiler with the options : -fullwarn -woff 1209,1174 (the -woff options are to turn off warnings about unused function parameters and controlling loop expressions being constants). Split prototype generation as we hit a limit in IRIX nawk. Removed "." code in smbd/filename.c (yet again :-). Jeremy. (This used to be commit e0567433bd72aec17bf5a54cc292701095d25f09) --- source3/lib/pidfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index b8c782f3d6..7e98438dba 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -30,7 +30,7 @@ extern int DEBUGLEVEL; /* return the pid in a pidfile. return 0 if the process (or pidfile) does not exist */ -int pidfile_pid(char *name) +pid_t pidfile_pid(char *name) { FILE *f; unsigned ret; @@ -51,7 +51,7 @@ int pidfile_pid(char *name) if (!process_exists(ret)) return 0; - return ret; + return (pid_t)ret; } /* create a pid file in the lock directory. open it and leave it locked */ -- cgit From 768761820e8d7481c586c4e0ab4ac7cb36d18c4b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 17 Nov 1998 20:50:07 +0000 Subject: Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls. Tidied up some of the mess (no other word for it). Still doesn't compile cleanly. There are calls with incorrect parameters that don't seem to be doing the right thing. This code still needs surgery :-(. Jeremy. (This used to be commit 18ff93a9abbf68ee8c59c0af3e57c63e4a015dac) --- source3/lib/pidfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 7e98438dba..52a3be875f 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -38,7 +38,7 @@ pid_t pidfile_pid(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - f = fopen(pidFile, "r"); + f = sys_fopen(pidFile, "r"); if (!f) { return 0; } @@ -71,7 +71,7 @@ void pidfile_create(char *name) exit(1); } - fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY, 0644); + fd = sys_open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY, 0644); if (fd < 0) { DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile, strerror(errno))); -- cgit From 84ba7b422dd65330a990e9d75b6225978c671180 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Dec 1998 08:09:59 +0000 Subject: fixed pidfile handling to check for a lock on the file, so we can be sure it is a samba process that is running. (This used to be commit f7ad78e369ebf2f4d31e8259e3e1fdd4c087b037) --- source3/lib/pidfile.c | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 52a3be875f..3e943577d8 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -32,26 +32,42 @@ extern int DEBUGLEVEL; does not exist */ pid_t pidfile_pid(char *name) { - FILE *f; + int fd; + char pidstr[20]; unsigned ret; pstring pidFile; slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - f = sys_fopen(pidFile, "r"); - if (!f) { + fd = open(pidFile, O_NONBLOCK | O_RDWR); + if (fd == -1) { return 0; } - if (fscanf(f,"%u", &ret) != 1) { - fclose(f); - return 0; + ZERO_ARRAY(pidstr); + + if (read(fd, pidstr, sizeof(pidstr)-1) <= 0) { + goto ok; } - fclose(f); + + ret = atoi(pidstr); - if (!process_exists(ret)) return 0; + if (!process_exists(ret)) { + goto ok; + } + + if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)==False) { + /* we could get the lock - it can't be a Samba process */ + goto ok; + } + close(fd); return (pid_t)ret; + + ok: + close(fd); + unlink(pidFile); + return 0; } /* create a pid file in the lock directory. open it and leave it locked */ @@ -65,14 +81,14 @@ void pidfile_create(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); pid = pidfile_pid(name); - if (pid > 0 && process_exists(pid)) { - DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", - name, pidFile, pid)); - exit(1); - } - - fd = sys_open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY, 0644); - if (fd < 0) { + if (pid != 0) { + DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", + name, pidFile, pid)); + exit(1); + } + + fd = sys_open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY | O_EXCL, 0644); + if (fd == -1) { DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile, strerror(errno))); exit(1); @@ -93,3 +109,4 @@ void pidfile_create(char *name) } /* Leave pid file open & locked for the duration... */ } + -- cgit From 637414904d38f6939ddcbecb38ba9a83ae17df3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Dec 1998 08:19:42 +0000 Subject: oops - lock test was the wrong way around (This used to be commit 783d4b3477fa9e363aa1f7524bd060019648ab0d) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 3e943577d8..6fc64aafe2 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -56,7 +56,7 @@ pid_t pidfile_pid(char *name) goto ok; } - if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)==False) { + if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)) { /* we could get the lock - it can't be a Samba process */ goto ok; } -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/lib/pidfile.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 6fc64aafe2..726e8c1f21 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -39,7 +39,7 @@ pid_t pidfile_pid(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - fd = open(pidFile, O_NONBLOCK | O_RDWR); + fd = sys_open(pidFile, O_NONBLOCK | O_RDWR, 0644); if (fd == -1) { return 0; } @@ -52,7 +52,7 @@ pid_t pidfile_pid(char *name) ret = atoi(pidstr); - if (!process_exists(ret)) { + if (!process_exists((pid_t)ret)) { goto ok; } @@ -76,14 +76,14 @@ void pidfile_create(char *name) int fd; char buf[20]; pstring pidFile; - int pid; + pid_t pid; slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); pid = pidfile_pid(name); if (pid != 0) { DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n", - name, pidFile, pid)); + name, pidFile, (int)pid)); exit(1); } @@ -109,4 +109,3 @@ void pidfile_create(char *name) } /* Leave pid file open & locked for the duration... */ } - -- cgit From 693ffb8466ada58ecc59fde754ba79fc6f51528d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 2 May 2000 02:23:41 +0000 Subject: Added sys_fork() and sys_getpid() functions to stop the overhead of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 726e8c1f21..a6dc327fd7 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -101,7 +101,7 @@ void pidfile_create(char *name) } memset(buf, 0, sizeof(buf)); - slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) getpid()); + slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid()); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile, strerror(errno))); -- cgit From 5f7c40f6d02df70dd3a92d5658f79b668e0ed5df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 27 May 2000 09:53:11 +0000 Subject: getting and setting security descriptors on printers now works this needed some fixes in tdb_unpack(). Tim, you'll need to update (This used to be commit 9422719ab4c35e4ce3199b62dd632433bf391283) --- source3/lib/pidfile.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index a6dc327fd7..25ff85483d 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -1,3 +1,5 @@ +/* this code is broken - there is a race condition with the unlink (tridge) */ + /* Unix SMB/Netbios implementation. Version 1.9. -- cgit From 61bb3093e32e9e1e58cec079ea101b5b11c5fee0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Aug 2001 17:32:45 +0000 Subject: Pidfile check can be read-only. Removed old ifdef in password.c Jeremy. (This used to be commit d82efc61ef16533c5652a5d4a9863f8317cb4ea2) --- source3/lib/pidfile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 25ff85483d..9de672010a 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -41,7 +41,7 @@ pid_t pidfile_pid(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - fd = sys_open(pidFile, O_NONBLOCK | O_RDWR, 0644); + fd = sys_open(pidFile, O_NONBLOCK | O_RONLY, 0644); if (fd == -1) { return 0; } @@ -49,24 +49,24 @@ pid_t pidfile_pid(char *name) ZERO_ARRAY(pidstr); if (read(fd, pidstr, sizeof(pidstr)-1) <= 0) { - goto ok; + goto noproc; } ret = atoi(pidstr); if (!process_exists((pid_t)ret)) { - goto ok; + goto noproc; } - if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)) { + if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_RDLCK)) { /* we could get the lock - it can't be a Samba process */ - goto ok; + goto noproc; } close(fd); return (pid_t)ret; - ok: + noproc: close(fd); unlink(pidFile); return 0; -- cgit From 861cb26f5d26790171b6a71d35fe2da7a50b386e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 1 Aug 2001 17:43:57 +0000 Subject: Oops. Typo. Jeremy. (This used to be commit d862be4b680fc495d920fa802854032e668a2073) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 9de672010a..a26aa12a3c 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -41,7 +41,7 @@ pid_t pidfile_pid(char *name) slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); - fd = sys_open(pidFile, O_NONBLOCK | O_RONLY, 0644); + fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644); if (fd == -1) { return 0; } -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/lib/pidfile.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index a26aa12a3c..a9b2da0d7f 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -23,9 +23,6 @@ #include "includes.h" - -extern int DEBUGLEVEL; - #ifndef O_NONBLOCK #define O_NONBLOCK #endif -- cgit From a45dbdd722132d4a21da7817041601db073ac0bc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 22 Jan 2002 00:35:51 +0000 Subject: Added comment about running lp_load() before calling pidfile_create(). (This used to be commit e05c9b34f084874fef3d9e6f39484242ed541940) --- source3/lib/pidfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index a9b2da0d7f..fad5691e0a 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -69,7 +69,10 @@ pid_t pidfile_pid(char *name) return 0; } -/* create a pid file in the lock directory. open it and leave it locked */ +/* Create a pid file in the lock directory. open it and leave it locked. + This must be done after a call to lp_load() as it uses the lp_lockdir() + function to generate the path to the pidfile. */ + void pidfile_create(char *name) { int fd; -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/lib/pidfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index fad5691e0a..28fd959b54 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -1,8 +1,7 @@ /* this code is broken - there is a race condition with the unlink (tridge) */ /* - Unix SMB/Netbios implementation. - Version 1.9. + Unix SMB/CIFS implementation. pidfile handling Copyright (C) Andrew Tridgell 1998 -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/lib/pidfile.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 28fd959b54..b98259fe5e 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -35,7 +35,7 @@ pid_t pidfile_pid(char *name) unsigned ret; pstring pidFile; - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644); if (fd == -1) { @@ -68,10 +68,7 @@ pid_t pidfile_pid(char *name) return 0; } -/* Create a pid file in the lock directory. open it and leave it locked. - This must be done after a call to lp_load() as it uses the lp_lockdir() - function to generate the path to the pidfile. */ - +/* create a pid file in the pid directory. open it and leave it locked */ void pidfile_create(char *name) { int fd; @@ -79,7 +76,7 @@ void pidfile_create(char *name) pstring pidFile; pid_t pid; - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_lockdir(), name); + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); pid = pidfile_pid(name); if (pid != 0) { -- cgit From 051286cd46a471dfeb1663aabf2ba17e580ca25d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 21 Oct 2002 00:20:12 +0000 Subject: Bugfix for pidfile_create() from Kelledin. (This used to be commit 5a6ab85ea5479d103026032bdab8b2355b9c564c) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index b98259fe5e..393fb57994 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -100,7 +100,7 @@ void pidfile_create(char *name) memset(buf, 0, sizeof(buf)); slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid()); - if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { + if (write(fd, buf, strlen(buf)) != strlen(buf)) { DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile, strerror(errno))); exit(1); -- cgit From 634c54310c92c48dd4eceec602e230a021bdcfc5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 3 Jan 2003 08:28:12 +0000 Subject: Merge from HEAD - make Samba compile with -Wwrite-strings without additional warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c) --- source3/lib/pidfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 393fb57994..16a12656b3 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -28,7 +28,7 @@ /* return the pid in a pidfile. return 0 if the process (or pidfile) does not exist */ -pid_t pidfile_pid(char *name) +pid_t pidfile_pid(const char *name) { int fd; char pidstr[20]; @@ -69,7 +69,7 @@ pid_t pidfile_pid(char *name) } /* create a pid file in the pid directory. open it and leave it locked */ -void pidfile_create(char *name) +void pidfile_create(const char *name) { int fd; char buf[20]; -- cgit From 266ec4aac04cb8666234f18baa38ff6387f40cb3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 24 Feb 2003 03:09:08 +0000 Subject: Merge doxygen, signed/unsigned, const and other small fixes from HEAD to 3.0. Andrew Bartlett (This used to be commit 9ef0d40c3f8aef52ab321dc065264c42065bc876) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 16a12656b3..1a462bf128 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -100,7 +100,7 @@ void pidfile_create(const char *name) memset(buf, 0, sizeof(buf)); slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid()); - if (write(fd, buf, strlen(buf)) != strlen(buf)) { + if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) { DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile, strerror(errno))); exit(1); -- cgit From 990d9d15db27f47d2a6cac306ab773d42427ade4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 24 Aug 2004 20:58:12 +0000 Subject: r2023: If there's garbage in the pidfile, we should not panic but assume that no one else is around. We can't find the other guy anyway. Volker (This used to be commit bf8773b094d41941478f0164ce33838027fadc09) --- source3/lib/pidfile.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 1a462bf128..20a8e82ce2 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -49,6 +49,13 @@ pid_t pidfile_pid(const char *name) } ret = atoi(pidstr); + + if (ret == 0) { + /* Obviously we had some garbage in the pidfile... */ + DEBUG(1, ("Could not parse contents of pidfile %s\n", + pidFile)); + goto noproc; + } if (!process_exists((pid_t)ret)) { goto noproc; -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 20a8e82ce2..b041eb7f1b 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -57,7 +57,7 @@ pid_t pidfile_pid(const char *name) goto noproc; } - if (!process_exists((pid_t)ret)) { + if (!process_exists_by_pid(ret)) { goto noproc; } -- cgit From 0af1500fc0bafe61019f1b2ab1d9e1d369221240 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Feb 2006 22:19:41 +0000 Subject: r13316: Let the carnage begin.... Sync with trunk as off r13315 (This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f) --- source3/lib/pidfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index b041eb7f1b..08e41083b5 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -32,7 +32,8 @@ pid_t pidfile_pid(const char *name) { int fd; char pidstr[20]; - unsigned ret; + pid_t pid; + unsigned int ret; pstring pidFile; slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); @@ -57,7 +58,8 @@ pid_t pidfile_pid(const char *name) goto noproc; } - if (!process_exists_by_pid(ret)) { + pid = (pid_t)ret; + if (!process_exists_by_pid(pid)) { goto noproc; } -- cgit From 27c4b072b06881fca8bab8a5f07a9e7ce5de173f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Nov 2006 09:37:52 +0000 Subject: r19533: Add a suffix to the program name if this is a process with a non-default configuration file name. Jeremy. (This used to be commit e8bf421c018ed829b9dba7c0872693080b77d49d) --- source3/lib/pidfile.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 08e41083b5..49626acade 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -78,13 +78,24 @@ pid_t pidfile_pid(const char *name) } /* create a pid file in the pid directory. open it and leave it locked */ -void pidfile_create(const char *name) +void pidfile_create(const char *program_name) { int fd; char buf[20]; + char *short_configfile; + pstring name; pstring pidFile; pid_t pid; + /* Add a suffix to the program name if this is a process with a + * none default configuration file name. */ + if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) { + strncpy( name, program_name, sizeof( name)-1); + } else { + short_configfile = strrchr( dyn_CONFIGFILE, '/'); + slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile+1); + } + slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); pid = pidfile_pid(name); -- cgit From b86758ebcc9d017594bf16041d4e83b6d8b27ff3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Apr 2007 22:08:44 +0000 Subject: r22113: Fix core dump when configfile in same directory. From Steven Danneman . Jeremy. (This used to be commit 572c418b04eb1dbce8da7643fe7e236b06fce57b) --- source3/lib/pidfile.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 49626acade..89ab6d799b 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -93,6 +93,13 @@ void pidfile_create(const char *program_name) strncpy( name, program_name, sizeof( name)-1); } else { short_configfile = strrchr( dyn_CONFIGFILE, '/'); + if (short_configfile == NULL) { + /* conf file in current directory */ + short_configfile = dyn_CONFIGFILE; + } else { + /* full/relative path provided */ + short_configfile++; + } slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile+1); } -- cgit From 32d22501842ebbf02d7de94785e866e49d1545b2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Jun 2007 13:40:58 +0000 Subject: r23595: One pstring a day... (This used to be commit 669eff902a20f3023360918ede6672d37b1f7d44) --- source3/lib/pidfile.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 89ab6d799b..9dc4f2f186 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -34,12 +34,15 @@ pid_t pidfile_pid(const char *name) char pidstr[20]; pid_t pid; unsigned int ret; - pstring pidFile; + char * pidFile; - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); + if (asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name) == -1) { + return 0; + } fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644); if (fd == -1) { + SAFE_FREE(pidFile); return 0; } @@ -68,12 +71,14 @@ pid_t pidfile_pid(const char *name) goto noproc; } + SAFE_FREE(pidFile); close(fd); return (pid_t)ret; noproc: close(fd); unlink(pidFile); + SAFE_FREE(pidFile); return 0; } @@ -83,14 +88,14 @@ void pidfile_create(const char *program_name) int fd; char buf[20]; char *short_configfile; - pstring name; - pstring pidFile; + char *name; + char *pidFile; pid_t pid; /* Add a suffix to the program name if this is a process with a * none default configuration file name. */ if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) { - strncpy( name, program_name, sizeof( name)-1); + name = SMB_STRDUP(program_name); } else { short_configfile = strrchr( dyn_CONFIGFILE, '/'); if (short_configfile == NULL) { @@ -100,10 +105,15 @@ void pidfile_create(const char *program_name) /* full/relative path provided */ short_configfile++; } - slprintf( name, sizeof( name)-1, "%s-%s", program_name, short_configfile+1); + if (asprintf(&name, "%s-%s", program_name, + short_configfile+1) == -1) { + smb_panic("asprintf failed"); + } } - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); + if (asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name) == -1) { + smb_panic("asprintf failed"); + } pid = pidfile_pid(name); if (pid != 0) { @@ -133,4 +143,6 @@ void pidfile_create(const char *program_name) exit(1); } /* Leave pid file open & locked for the duration... */ + SAFE_FREE(name); + SAFE_FREE(pidFile); } -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 9dc4f2f186..552d488109 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/lib/pidfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 552d488109..5506b46961 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 40485cc81f4f87f2fd642655369abc9cd9cbd9d3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 23 Jul 2007 19:09:19 +0000 Subject: r24008: Fix Bug 4792. Thanks to David Gajewski and to Timur I. Bakeyev for bugging me :-) Volker (This used to be commit 59aef0451bed536d5cd72f2b26a0595947e94343) --- source3/lib/pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 5506b46961..b6a8e02b49 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -105,7 +105,7 @@ void pidfile_create(const char *program_name) short_configfile++; } if (asprintf(&name, "%s-%s", program_name, - short_configfile+1) == -1) { + short_configfile) == -1) { smb_panic("asprintf failed"); } } -- cgit From 7faee02d0d351c5c039e8f1be7e82ce3a93cbe96 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Dec 2007 11:30:37 -0800 Subject: Remove the char[1024] strings from dynconfig. Replace them with malloc'ing accessor functions. Should save a lot of static space :-). Jeremy. (This used to be commit 52dc5eaef2106015b3a8b659e818bdb15ad94b05) --- source3/lib/pidfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/lib/pidfile.c') diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index b6a8e02b49..f49f8afbb6 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -86,20 +86,20 @@ void pidfile_create(const char *program_name) { int fd; char buf[20]; - char *short_configfile; + const char *short_configfile; char *name; char *pidFile; pid_t pid; /* Add a suffix to the program name if this is a process with a * none default configuration file name. */ - if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) { + if (strcmp( CONFIGFILE, get_dyn_CONFIGFILE()) == 0) { name = SMB_STRDUP(program_name); } else { - short_configfile = strrchr( dyn_CONFIGFILE, '/'); + short_configfile = strrchr( get_dyn_CONFIGFILE(), '/'); if (short_configfile == NULL) { /* conf file in current directory */ - short_configfile = dyn_CONFIGFILE; + short_configfile = get_dyn_CONFIGFILE(); } else { /* full/relative path provided */ short_configfile++; -- cgit