mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-06-15 14:42:23 +00:00
moved manpage stuff into doc subdir to less confuse users, fixed some warnings on intrepid ubuntu, fixed some non documented return codes
This commit is contained in:
parent
040ca04cb6
commit
bb9956cc7a
16
Makefile.am
16
Makefile.am
|
@ -11,11 +11,11 @@ TESTS = tests/help.sh \
|
||||||
|
|
||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
|
|
||||||
EXTRA_DIST = config.h.in inotify-nosys.h \
|
EXTRA_DIST = config.h.in inotify-nosys.h lsyncd.conf.xml \
|
||||||
manpage.lsyncd.xml manpage.lsyncd.conf.xml lsyncd.conf.xml \
|
doc/manpage.lsyncd.xml doc/manpage.lsyncd.conf.xml \
|
||||||
lsyncd.1 lsyncd.conf.xml.5
|
doc/lsyncd.1 doc/lsyncd.conf.xml.5
|
||||||
|
|
||||||
nodist_man1_MANS = lsyncd.1 lsyncd.conf.xml.5
|
nodist_man1_MANS = doc/lsyncd.1 doc/lsyncd.conf.xml.5
|
||||||
|
|
||||||
check-syntax:
|
check-syntax:
|
||||||
$(CC) -c -O2 -Wall $(CHK_SOURCES) -o/dev/null
|
$(CC) -c -O2 -Wall $(CHK_SOURCES) -o/dev/null
|
||||||
|
@ -26,11 +26,11 @@ XP = xsltproc -''-nonet \
|
||||||
-''-param make.year.ranges "1" \
|
-''-param make.year.ranges "1" \
|
||||||
-''-param make.single.year.ranges "1"
|
-''-param make.single.year.ranges "1"
|
||||||
|
|
||||||
lsyncd.1: manpage.lsyncd.xml
|
doc/lsyncd.1: doc/manpage.lsyncd.xml
|
||||||
$(XP) $(DB2MAN) $<
|
$(XP) -o $@ $(DB2MAN) $<
|
||||||
|
|
||||||
lsyncd.conf.xml.5: manpage.lsyncd.conf.xml
|
doc/lsyncd.conf.xml.5: doc/manpage.lsyncd.conf.xml
|
||||||
$(XP) $(DB2MAN) $<
|
$(XP) -o $@ $(DB2MAN) $<
|
||||||
|
|
||||||
AM_CFLAGS=-Wall
|
AM_CFLAGS=-Wall
|
||||||
AM_LDFLAGS=
|
AM_LDFLAGS=
|
||||||
|
|
|
@ -62,7 +62,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
|
||||||
<author>
|
<author>
|
||||||
<firstname>Axel</firstname>
|
<firstname>Axel</firstname>
|
||||||
<surname>Kittenberger</surname>
|
<surname>Kittenberger</surname>
|
||||||
<contrib>Strives to keep this uptodate.</contrib>
|
<contrib>Strives to keep this up to date.</contrib>
|
||||||
<address>
|
<address>
|
||||||
<email>axel.kittenberger@univie.ac.at</email>
|
<email>axel.kittenberger@univie.ac.at</email>
|
||||||
</address>
|
</address>
|
||||||
|
@ -301,6 +301,11 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
|
||||||
<seg><errorcode>6</errorcode></seg>
|
<seg><errorcode>6</errorcode></seg>
|
||||||
<seg>Something wrong with the config file.</seg>
|
<seg>Something wrong with the config file.</seg>
|
||||||
</seglistitem>
|
</seglistitem>
|
||||||
|
|
||||||
|
<seglistitem>
|
||||||
|
<seg><errorcode>7</errorcode></seg>
|
||||||
|
<seg>Kernel cannot do inotify.</seg>
|
||||||
|
</seglistitem>
|
||||||
|
|
||||||
<seglistitem>
|
<seglistitem>
|
||||||
<seg><errorcode>255</errorcode></seg>
|
<seg><errorcode>255</errorcode></seg>
|
37
lsyncd.c
37
lsyncd.c
|
@ -68,7 +68,10 @@ enum lsyncd_exit_code
|
||||||
/* something wrong with the config file */
|
/* something wrong with the config file */
|
||||||
LSYNCD_BADCONFIGFILE = 6,
|
LSYNCD_BADCONFIGFILE = 6,
|
||||||
|
|
||||||
/* Internal exit code to denote that execv failed */
|
/* cannot open inotify instance */
|
||||||
|
LSYNCD_NOINOTIFY = 7,
|
||||||
|
|
||||||
|
/* something internal went really wrong */
|
||||||
LSYNCD_INTERNALFAIL = 255,
|
LSYNCD_INTERNALFAIL = 255,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -697,8 +700,12 @@ bool action(struct dir_conf * dir_conf,
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
char * binary = dir_conf->binary ? dir_conf->binary : default_binary;
|
char * binary = dir_conf->binary ? dir_conf->binary : default_binary;
|
||||||
if (!flag_nodaemon) {
|
if (!flag_nodaemon) {
|
||||||
freopen(logfile, "a", stdout);
|
if (!freopen(logfile, "a", stdout)) {
|
||||||
freopen(logfile, "a", stderr);
|
printlogf(LOG_ERROR, "cannot redirect stdout to [%s].", logfile);
|
||||||
|
}
|
||||||
|
if (!freopen(logfile, "a", stderr)) {
|
||||||
|
printlogf(LOG_ERROR, "cannot redirect stderr to [%s].", logfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
execv(binary, argv); // in a sane world does not return!
|
execv(binary, argv); // in a sane world does not return!
|
||||||
|
@ -1505,8 +1512,11 @@ bool parse_config(bool fullparse) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the command line options.
|
* Parses the command line options.
|
||||||
|
*
|
||||||
|
* exits() in some cases of badparameters, or on
|
||||||
|
* --version or --help
|
||||||
*/
|
*/
|
||||||
bool parse_options(int argc, char **argv)
|
void parse_options(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char **target;
|
char **target;
|
||||||
|
|
||||||
|
@ -1546,7 +1556,7 @@ bool parse_options(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c == '?') {
|
if (c == '?') {
|
||||||
return false;
|
exit(LSYNCD_BADPARAMETERS);
|
||||||
}
|
}
|
||||||
if (c == 0) { // longoption
|
if (c == 0) { // longoption
|
||||||
if (!strcmp("conf", long_options[oi].name)) {
|
if (!strcmp("conf", long_options[oi].name)) {
|
||||||
|
@ -1584,7 +1594,7 @@ bool parse_options(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '?') {
|
if (c == '?') {
|
||||||
return false;
|
exit(LSYNCD_BADPARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == 0) { // longoption
|
if (c == 0) { // longoption
|
||||||
|
@ -1656,7 +1666,6 @@ bool parse_options(int argc, char **argv)
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
check_absolute_path(pidfile);
|
check_absolute_path(pidfile);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1748,27 +1757,28 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!parse_options(argc, argv)) {
|
parse_options(argc, argv);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (default_exclude_file) {
|
if (default_exclude_file) {
|
||||||
parse_exclude_file(default_exclude_file);
|
parse_exclude_file(default_exclude_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
inotf = inotify_init();
|
inotf = inotify_init();
|
||||||
|
|
||||||
if (inotf == -1) {
|
if (inotf == -1) {
|
||||||
printlogf(LOG_ERROR, "Cannot create inotify instance! (%d:%s)",
|
printlogf(LOG_ERROR, "Cannot create inotify instance! (%d:%s)",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
return -1;
|
return LSYNCD_NOINOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flag_nodaemon) {
|
if (!flag_nodaemon) {
|
||||||
// this will make this process child of init
|
// this will make this process child of init
|
||||||
// close stdin/stdout/stderr and
|
// close stdin/stdout/stderr and
|
||||||
// chdir to /
|
// chdir to /
|
||||||
daemon(0, 0);
|
if (daemon(0, 0)) {
|
||||||
|
printlogf(LOG_ERROR, "Cannot daemonize! (%d:%s)",
|
||||||
|
errno, strerror(errno));
|
||||||
|
return LSYNCD_INTERNALFAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printlogf(LOG_NORMAL, "Starting up");
|
printlogf(LOG_NORMAL, "Starting up");
|
||||||
|
@ -1814,6 +1824,7 @@ int main(int argc, char **argv)
|
||||||
dir_watch_num);
|
dir_watch_num);
|
||||||
|
|
||||||
signal(SIGTERM, catch_alarm);
|
signal(SIGTERM, catch_alarm);
|
||||||
|
|
||||||
master_loop();
|
master_loop();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user