mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Replace usage of strerror()/strcpy() with strerror_r() here, reducing
number of required operations to get error message and avoiding of strerror's buffer clobbering. Also ANSI'fy prototypes while I'm here
This commit is contained in:
parent
923d9b0109
commit
75667314a9
1 changed files with 2 additions and 4 deletions
|
|
@ -41,16 +41,14 @@ __FBSDID("$FreeBSD$");
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
getwd(buf)
|
||||
char *buf;
|
||||
getwd(char *buf)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ( (p = getcwd(buf, MAXPATHLEN)) )
|
||||
return(p);
|
||||
(void)strcpy(buf, strerror(errno));
|
||||
(void)strerror_r(errno, buf, MAXPATHLEN);
|
||||
return((char *)NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue