[vhffs-dev] [1352] now using the foreground argument value |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1352
Author: gradator
Date: 2009-03-03 01:37:39 +0100 (Tue, 03 Mar 2009)
Log Message:
-----------
now using the foreground argument value
Modified Paths:
--------------
trunk/vhffs-fssync/vhffsfssync_master.c
trunk/vhffs-fssync/vhffsfssync_slave.c
Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c 2009-02-21 23:54:06 UTC (rev 1351)
+++ trunk/vhffs-fssync/vhffsfssync_master.c 2009-03-03 00:37:39 UTC (rev 1352)
@@ -1559,8 +1559,8 @@
struct option long_options[] = {
{ "foreground", no_argument, NULL, 'f' },
- { "bind", required_argument, NULL, 'b' },
- { "port", required_argument, NULL, 'p' },
+ { "bind", required_argument, NULL, 'b' },
+ { "port", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ 0, 0, 0, 0 }
@@ -1611,6 +1611,13 @@
root = argv[optind++];
+ if(!foreground) {
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+ if(fork()) exit(0);
+ }
+
/* chdir() to the filesystem to monitor */
if(!root) return -1;
if( root[strlen(root)-1] == '/' ) root[strlen(root)-1] = '\0';
Modified: trunk/vhffs-fssync/vhffsfssync_slave.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_slave.c 2009-02-21 23:54:06 UTC (rev 1351)
+++ trunk/vhffs-fssync/vhffsfssync_slave.c 2009-03-03 00:37:39 UTC (rev 1352)
@@ -716,6 +716,13 @@
root = argv[optind++];
+ if(!foreground) {
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+ if(fork()) exit(0);
+ }
+
/* chdir() to the filesystem to write the data */
if( chdir(root) < 0 ) {
fprintf(stderr, "cannot chdir() to %s: %s\n", root, strerror(errno));