From owner-svn-src-all@freebsd.org Fri Sep 27 16:57:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0214127CBB; Fri, 27 Sep 2019 16:57:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fydm5ZJqz43R4; Fri, 27 Sep 2019 16:57:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A210A1BE51; Fri, 27 Sep 2019 16:57:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8RGvWWE061179; Fri, 27 Sep 2019 16:57:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8RGvW3S061178; Fri, 27 Sep 2019 16:57:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909271657.x8RGvW3S061178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Sep 2019 16:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352803 - head/tools/tools/controlelf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/tools/controlelf X-SVN-Commit-Revision: 352803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 16:57:32 -0000 Author: emaste Date: Fri Sep 27 16:57:32 2019 New Revision: 352803 URL: https://svnweb.freebsd.org/changeset/base/352803 Log: controlelf: some style(9) cleanup Submitted by: clang-format Modified: head/tools/tools/controlelf/controlelf.c Modified: head/tools/tools/controlelf/controlelf.c ============================================================================== --- head/tools/tools/controlelf/controlelf.c Fri Sep 27 16:46:08 2019 (r352802) +++ head/tools/tools/controlelf/controlelf.c Fri Sep 27 16:57:32 2019 (r352803) @@ -14,7 +14,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -47,11 +47,11 @@ __FBSDID("$FreeBSD$"); -static bool convert_to_feature_val(char*, u_int32_t*); -static bool edit_file_features(Elf *, int, int, char*); +static bool convert_to_feature_val(char *, u_int32_t *); +static bool edit_file_features(Elf *, int, int, char *); static bool get_file_features(Elf *, int, int, u_int32_t *, u_int64_t *); static void print_features(void); -static bool print_file_features(Elf *, int, int, char*); +static bool print_file_features(Elf *, int, int, char *); static void usage(void); struct ControlFeatures { @@ -61,12 +61,12 @@ struct ControlFeatures { }; static struct ControlFeatures featurelist[] = { - { "aslr", NT_FREEBSD_FCTL_ASLR_DISABLE, "Disable ASLR" } + { "aslr", NT_FREEBSD_FCTL_ASLR_DISABLE, "Disable ASLR" }, }; static struct option controlelf_longopts[] = { - { "help", no_argument, NULL, 'h' }, - { NULL, 0, NULL, 0 } + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } }; int @@ -117,8 +117,8 @@ main(int argc, char **argv) while (argc) { elf = NULL; - if ((fd = open(argv[0], editfeatures ? O_RDWR : - O_RDONLY, 0)) < 0) { + if ((fd = open(argv[0], + editfeatures ? O_RDWR : O_RDONLY, 0)) < 0) { warn("error opening file %s", argv[0]); retval = 1; goto fail; @@ -134,8 +134,7 @@ main(int argc, char **argv) if (kind == ELF_K_AR) warnx("file '%s' is an archive", argv[0]); else - warnx("file '%s' is not an ELF file", - argv[0]); + warnx("file '%s' is not an ELF file", argv[0]); retval = 1; goto fail; } @@ -147,11 +146,13 @@ main(int argc, char **argv) } if (!editfeatures) { - if (!print_file_features(elf, ehdr.e_phnum, fd, argv[0])) { + if (!print_file_features(elf, ehdr.e_phnum, fd, + argv[0])) { retval = 1; goto fail; } - } else if (!edit_file_features(elf, ehdr.e_phnum, fd, features)) { + } else if (!edit_file_features(elf, ehdr.e_phnum, fd, + features)) { retval = 1; goto fail; } @@ -169,7 +170,8 @@ fail: return (retval); } -#define USAGE_MESSAGE "\ +#define USAGE_MESSAGE \ + "\ Usage: %s [options] file...\n\ Set or display the control features for an ELF object.\n\n\ Supported options are:\n\ @@ -186,7 +188,7 @@ usage(void) } static bool -convert_to_feature_val(char* feature_str, u_int32_t* feature_val) +convert_to_feature_val(char *feature_str, u_int32_t *feature_val) { char *feature_input, *feature; int i, len; @@ -262,7 +264,8 @@ print_features(void) } static bool -print_file_features(Elf *elf, int phcount, int fd, char *filename) { +print_file_features(Elf *elf, int phcount, int fd, char *filename) +{ u_int32_t features; unsigned long i; @@ -284,7 +287,8 @@ print_file_features(Elf *elf, int phcount, int fd, cha } static bool -get_file_features(Elf *elf, int phcount, int fd, u_int32_t *features, u_int64_t *off) +get_file_features(Elf *elf, int phcount, int fd, u_int32_t *features, + u_int64_t *off) { GElf_Phdr phdr; Elf_Note note;