Skip to content

Commit

Permalink
Change strmode argument type to mode_t
Browse files Browse the repository at this point in the history
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:	freebsd/freebsd-src#493
  • Loading branch information
AZero13 authored and bsdimp committed Jun 29, 2021
1 parent ed1a156 commit 849dcdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/string/strmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 849dcdb

Please sign in to comment.