Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 2021 23:41:19 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 849dcdb1c0c5 - main - Change strmode argument type to mode_t
Message-ID:  <202106292341.15TNfJV5067721@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=849dcdb1c0c50b13f97d67c912f0edac82688281

commit 849dcdb1c0c50b13f97d67c912f0edac82688281
Author:     Alfonso Gregory <gfunni234@gmail.com>
AuthorDate: 2021-06-25 15:35:14 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
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 <string.h>
 
 void
-strmode(/* mode_t */ int mode, char *p)
+strmode(mode_t mode, char *p)
 {
 	 /* print type */
 	switch (mode & S_IFMT) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106292341.15TNfJV5067721>