From owner-dev-commits-src-all@freebsd.org Tue Jun 29 23:41:19 2021 Return-Path: Delivered-To: dev-commits-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 DD54D65686E; Tue, 29 Jun 2021 23:41:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GF1Fq5zS1z4j5F; Tue, 29 Jun 2021 23:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B584F21DE9; Tue, 29 Jun 2021 23:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15TNfJG4067722; Tue, 29 Jun 2021 23:41:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15TNfJV5067721; Tue, 29 Jun 2021 23:41:19 GMT (envelope-from git) Date: Tue, 29 Jun 2021 23:41:19 GMT Message-Id: <202106292341.15TNfJV5067721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 849dcdb1c0c5 - main - Change strmode argument type to mode_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 849dcdb1c0c50b13f97d67c912f0edac82688281 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2021 23:41:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=849dcdb1c0c50b13f97d67c912f0edac82688281 commit 849dcdb1c0c50b13f97d67c912f0edac82688281 Author: Alfonso Gregory AuthorDate: 2021-06-25 15:35:14 +0000 Commit: Warner Losh CommitDate: 2021-06-29 23:38:45 +0000 Change strmode argument type to mode_t Finally, we have the correct function definition for strmode. NetBSD/OpenBSD did this many years ago. This code is weird sign extension safe. Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/493 --- include/string.h | 8 +++++++- lib/libc/string/strmode.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/string.h b/include/string.h index 774cf5fe9756..540258cfcf4f 100644 --- a/include/string.h +++ b/include/string.h @@ -96,7 +96,13 @@ size_t strlcpy(char * __restrict, const char * __restrict, size_t); #endif size_t strlen(const char *) __pure; #if __BSD_VISIBLE -void strmode(int, char *); + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + +void strmode(mode_t, char *); #endif char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; diff --git a/lib/libc/string/strmode.c b/lib/libc/string/strmode.c index 50016be21ea1..d601bd0430e1 100644 --- a/lib/libc/string/strmode.c +++ b/lib/libc/string/strmode.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include void -strmode(/* mode_t */ int mode, char *p) +strmode(mode_t mode, char *p) { /* print type */ switch (mode & S_IFMT) {