From 82da1a6f2fec85651f27ae10e2d1d9ae1336e2b1 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 1 Jan 2022 19:53:40 +0000 Subject: [PATCH] make: reduce indentation in Main_SetObjdir No functional change. --- usr.bin/make/main.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 57289a5ee367..71e95e05c16b 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.563 2021/12/31 00:18:06 rillig Exp $ */ +/* $NetBSD: main.c,v 1.564 2022/01/01 19:53:40 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.563 2021/12/31 00:18:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.564 2022/01/01 19:53:40 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -702,7 +702,6 @@ Main_SetObjdir(bool writable, const char *fmt, ...) char *path; char buf[MAXPATHLEN + 1]; char buf2[MAXPATHLEN + 1]; - bool rc = false; va_list ap; va_start(ap, fmt); @@ -715,24 +714,23 @@ Main_SetObjdir(bool writable, const char *fmt, ...) } /* look for the directory and try to chdir there */ - if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { - if ((writable && access(path, W_OK) != 0) || - chdir(path) != 0) { - (void)fprintf(stderr, "%s warning: %s: %s.\n", - progname, path, strerror(errno)); - } else { - snprintf(objdir, sizeof objdir, "%s", path); - Global_Set(".OBJDIR", objdir); - setenv("PWD", objdir, 1); - Dir_InitDot(); - purge_relative_cached_realpaths(); - rc = true; - if (opts.enterFlag && strcmp(objdir, curdir) != 0) - enterFlagObj = true; - } + if (stat(path, &sb) != 0 || !S_ISDIR(sb.st_mode)) + return false; + + if ((writable && access(path, W_OK) != 0) || chdir(path) != 0) { + (void)fprintf(stderr, "%s warning: %s: %s.\n", + progname, path, strerror(errno)); + return false; } - return rc; + snprintf(objdir, sizeof objdir, "%s", path); + Global_Set(".OBJDIR", objdir); + setenv("PWD", objdir, 1); + Dir_InitDot(); + purge_relative_cached_realpaths(); + if (opts.enterFlag && strcmp(objdir, curdir) != 0) + enterFlagObj = true; + return true; } static bool