lists.arthurdejong.org
RSS feed

cvsd commit: MODIFIED: . ...

[Date Prev][Date Next] [Thread Prev][Thread Next]

cvsd commit: MODIFIED: . ...



User: arthur
Date: 24/11/09 17:48:15

Modified:    . cfg.c cfg.h cvsd.8.in cvsd.c
Log:
add a --nofork argument to cvsd (thanks ??????)


Revision  Changes    Path
1.10      +1 -0      cvsd/cfg.c

Index: cfg.c
===================================================================
RCS file: /home/arthur/devel/repos/cvsd/cfg.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- cfg.c       4 Oct 2011 19:30:41 -0000       1.9
+++ cfg.c       9 Nov 2024 16:48:15 -0000       1.10
@@ -55,6 +55,7 @@
   cfg=(struct cvsd_cfg *)xmalloc(sizeof(struct cvsd_cfg));
   cfg->configfile = DEFAULT_CONFIGFILE;
   cfg->pidfile    = NULL;
+  cfg->nofork     = 0;
   cfg->debugging  = 0;
   cfg->rootjail   = NULL;
   cfg->uid        = NOUID;


1.7       +3 -0      cvsd/cfg.h

Index: cfg.h
===================================================================
RCS file: /home/arthur/devel/repos/cvsd/cfg.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cfg.h       21 May 2006 14:36:01 -0000      1.6
+++ cfg.h       9 Nov 2024 16:48:15 -0000       1.7
@@ -68,6 +68,9 @@
      default is no pidfile (NULL) */
   char *pidfile;
 
+  /* whether to skip daemon(3) */
+  unsigned nofork;
+
   /* whether debugging mode is enabled */
   int debugging;
 


1.15      +3 -0      cvsd/cvsd.8.in

Index: cvsd.8.in
===================================================================
RCS file: /home/arthur/devel/repos/cvsd/cvsd.8.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- cvsd.8.in   12 Jun 2009 21:48:30 -0000      1.14
+++ cvsd.8.in   9 Nov 2024 16:48:15 -0000       1.15
@@ -38,6 +38,9 @@
 .B  \-f, \-\-config=FILE
 Use FILE as configfile (default is @CONFIGFILE@).
 .TP
+.B \-\-nofork
+\fBcvsd\fP will not put itself in the background.
+.TP
 .B \-d, \-\-debug
 Enable debugging mode.
 \fBcvsd\fP will not put itself in the background and sends verbose debugging 
info to stderr.


1.128     +7 -1      cvsd/cvsd.c

Index: cvsd.c
===================================================================
RCS file: /home/arthur/devel/repos/cvsd/cvsd.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -b -r1.127 -r1.128
--- cvsd.c      9 Nov 2024 16:27:36 -0000       1.127
+++ cvsd.c      9 Nov 2024 16:48:15 -0000       1.128
@@ -136,6 +136,7 @@
   fprintf(fp,"Usage: %s [OPTION]...\n",program_name);
   fprintf(fp,"chroot wrapper to run `cvs pserver' more securely.\n");
   fprintf(fp,"  -f, --config=FILE  use FILE as configfile (default 
%s)\n",DEFAULT_CONFIGFILE);
+  fprintf(fp,"      --nofork       don't fork\n");
   fprintf(fp,"  -d, --debug        don't fork and print debugging to 
stderr\n");
   fprintf(fp,"      --help         display this help and exit\n");
   fprintf(fp,"      --version      output version information and exit\n");
@@ -148,6 +149,7 @@
 static struct option const cvsd_options[] =
 {
   { "config",      required_argument, NULL, 'f' },
+  { "nofork",      no_argument,       NULL, 'n' },
   { "debug",       no_argument,       NULL, 'd' },
   { "help",        no_argument,       NULL, 'h' },
   { "version",     no_argument,       NULL, 'V' },
@@ -173,7 +175,11 @@
       }
       cfg->configfile=xstrdup(optarg);
       break;
+    case 'n': /*     --nofork       don't fork */
+      cfg->nofork=1;
+      break;
     case 'd': /* -d, --debug        don't fork and print debugging to stderr */
+      cfg->nofork=1;
       cfg->debugging=1;
       log_setdefaultloglevel(LOG_DEBUG);
       break;
@@ -738,7 +744,7 @@
     cfg_addaddress(cfg,NULL,0,DEFAULT_ADDR,DEFAULT_PORT);
 
   /* daemonize */
-  if ((!cfg->debugging)&&(daemon(0,0)<0))
+  if ((!cfg->nofork)&&(daemon(0,0)<0))
   {
     log_log(LOG_ERR,"unable to daemonize: %s",strerror(errno));
     exit(1);