summaryrefslogtreecommitdiff
path: root/source3/web/startstop.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/web/startstop.c')
-rw-r--r--source3/web/startstop.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/source3/web/startstop.c b/source3/web/startstop.c
index 63a9f298a5..436666f849 100644
--- a/source3/web/startstop.c
+++ b/source3/web/startstop.c
@@ -25,60 +25,60 @@
/** Startup smbd from web interface. */
void start_smbd(void)
{
- pstring binfile;
+ char *binfile = NULL;
- if (geteuid() != 0) return;
+ if (geteuid() != 0) {
+ return;
+ }
if (fork()) {
return;
}
- slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR);
-
- become_daemon(True, False);
-
- execl(binfile, binfile, "-D", NULL);
-
+ if (asprintf(&binfile, "%s/smbd", dyn_SBINDIR) > 0) {
+ become_daemon(true, false);
+ execl(binfile, binfile, "-D", NULL);
+ }
exit(0);
}
/* startup nmbd */
void start_nmbd(void)
{
- pstring binfile;
+ char *binfile = NULL;
- if (geteuid() != 0) return;
+ if (geteuid() != 0) {
+ return;
+ }
if (fork()) {
return;
}
- slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR);
-
- become_daemon(True, False);
-
- execl(binfile, binfile, "-D", NULL);
-
+ if (asprintf(&binfile, "%s/nmbd", dyn_SBINDIR) > 0) {
+ become_daemon(true, false);
+ execl(binfile, binfile, "-D", NULL);
+ }
exit(0);
}
/** Startup winbindd from web interface. */
void start_winbindd(void)
{
- pstring binfile;
+ char *binfile = NULL;
- if (geteuid() != 0) return;
+ if (geteuid() != 0) {
+ return;
+ }
if (fork()) {
return;
}
- slprintf(binfile, sizeof(pstring) - 1, "%s/winbindd", dyn_SBINDIR);
-
- become_daemon(True, False);
-
- execl(binfile, binfile, NULL);
-
+ if (asprintf(&binfile, "%s/winbindd", dyn_SBINDIR) > 0) {
+ become_daemon(true, false);
+ execl(binfile, binfile, NULL);
+ }
exit(0);
}