From 61143fa55e90a33cf24e94f27255750b9b8b0caa Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 14 Oct 2014 15:06:58 +0200 Subject: move reinitialization of getopt() down --- journal-notify.c | 6 +++--- 1 file 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) { -- cgit v1.2.3-70-g09d2