aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-10-14 15:06:58 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-10-14 15:06:58 +0200
commit61143fa55e90a33cf24e94f27255750b9b8b0caa (patch)
treefb9dfb2275fdea75d96602af5efe1774e646ad3f
parentd6720eec30e42f263b0d311b107b752979517717 (diff)
downloadjournal-notify-61143fa55e90a33cf24e94f27255750b9b8b0caa.tar.gz
journal-notify-61143fa55e90a33cf24e94f27255750b9b8b0caa.tar.zst
move reinitialization of getopt() down
-rw-r--r--journal-notify.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/journal-notify.c b/journal-notify.c
index f733477..39dcd1c 100644
--- a/journal-notify.c
+++ b/journal-notify.c
@@ -91,9 +91,6 @@ int main(int argc, char **argv) {
if (verbose > 0)
printf("%s v%s (compiled: " __DATE__ ", " __TIME__ ")\n", program, VERSION);
- /* reinitialize getopt() by resetting optind to 0 */
- optind = 0;
-
/* open journal */
if ((rc = sd_journal_open(&journal, SD_JOURNAL_LOCAL_ONLY + SD_JOURNAL_SYSTEM)) < 0) {
fprintf(stderr, "Failed to open journal: %s\n", strerror(-rc));
@@ -112,6 +109,9 @@ int main(int argc, char **argv) {
goto out30;
}
+ /* reinitialize getopt() by resetting optind to 0 */
+ optind = 0;
+
/* get command line options - part II*/
while ((i = getopt_long(argc, argv, optstring, options_long, NULL)) != -1) {
switch (i) {