From: Ben Harris Date: Thu, 22 Nov 2018 22:34:33 +0000 (+0000) Subject: Fix init_statefile to not use optarg. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=e1a9b5de99e8da457fea03efa2d27e43175cfbb9;p=clunk.git Fix init_statefile to not use optarg. I failed to update it to use a local variable when I moved it out of init(). --- diff --git a/clunk.c b/clunk.c index 312371f..0f0df9e 100644 --- a/clunk.c +++ b/clunk.c @@ -112,12 +112,12 @@ init_statefile(char const *statefilename) char buf[10]; ssize_t len; - statefd = open(optarg, O_RDWR | O_CREAT | O_DSYNC, 0666); + statefd = open(statefilename, O_RDWR | O_CREAT | O_DSYNC, 0666); if (statefd == -1) - err(1, "%s", optarg); + err(1, "%s", statefilename); len = pread(statefd, buf, 9, 0); if (len == -1) - err(1, "read %s", optarg); + err(1, "read %s", statefilename); if (len > 0) { buf[len] = '\0'; init_statestring(buf);