Skip to content

Commit 1a5c1d8

Browse files
committed
Unify variable initialization
We initialized some variables at the top of main(), and some before the first use. Since these variables are used during cleanup it makes sense to initialize all of them at the top. Use one variable per line to make the code easier to read. Signed-off-by: Nir Soffer <nirsof@gmail.com>
1 parent 0f61b07 commit 1a5c1d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,9 @@ static void on_accept(struct state *state, int accept_fd, interface_ref iface);
395395

396396
int main(int argc, char *argv[]) {
397397
debug = getenv("DEBUG") != NULL;
398-
int rc = 1, listen_fd = -1;
398+
int rc = 1;
399+
int listen_fd = -1;
400+
int pidfile_fd = -1;
399401
__block interface_ref iface = NULL;
400402

401403
struct state state = {0};
@@ -409,7 +411,6 @@ int main(int argc, char *argv[]) {
409411
WARN("Seems running with SETUID. This is insecure and highly discouraged: See README.md");
410412
}
411413

412-
int pidfile_fd = -1;
413414
if (cliopt->pidfile != NULL) {
414415
pidfile_fd = create_pidfile(cliopt->pidfile);
415416
if (pidfile_fd == -1) {

0 commit comments

Comments
 (0)