1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-19 01:17:36 +00:00

Use getcwd() instead of getwd(). (#20)

getwd() has been deprecated for a long time and getcwd() should
be used instead.
This commit is contained in:
Bruce Mitchener 2020-12-11 00:24:21 +07:00 committed by GitHub
parent 11c083d792
commit d6d2a3371a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -271,7 +271,6 @@ typedef unsigned long u_long;
#undef UNALIGNED_FETCH_OK
#undef HAS_GETHOSTID
#define seteuid(x) setresuid(-1, (x), -1)
#define getwd(x) getcwd((x), MAXPATHLEN)
#define getrusage(x, y)
#define getpagesize() 4096
#define USE_UTIME
@ -308,7 +307,6 @@ typedef signed char s_char;
#undef UNALIGNED_FETCH_OK
#define MAXPATHLEN MAXNAMLEN
#define EWOULDBLOCK EAGAIN
#define getwd(x) getcwd((x), MAXPATHLEN)
/* we compile on a 386 with GCC, so can use optimizations. */
#define GCC386
#define RESWAPPEDCODESTREAM
@ -424,7 +422,6 @@ typedef unsigned short u_short;
#define SYSVONLY 1
#define SYSVSIGNALS 1
#define NOETHER 1
#define getwd(x) getcwd((x), MAXPATHLEN)
#define USHORT unsigned
#else
#define USHORT unsigned short
@ -453,7 +450,6 @@ typedef unsigned short u_short;
#if !defined(LINUX) && !defined(MACOSX) && !defined(FREEBSD)
/* these are in the POSIX standard */
#define getwd(x) getcwd((x), MAXPATHLEN)
#define getrusage(x, y)
#define getpagesize() 4096
#endif /* LINUX , MACOSX, FREEBSD */

View File

@ -552,7 +552,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
* "..>" or ".." means the parent directory of the
* user's current working directory.
*/
if (getwd(dst) == 0) return (0);
if (getcwd(dst, MAXPATHLEN) == 0) return (0);
#ifdef DOS
dp = max(strrchr(dst, '/'), strrchr(dst, DIRSEP));
#else
@ -575,7 +575,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
#endif
case '>':
/* ".>" means the user's current working directory. */
if (getwd(dst) == 0) return (0);
if (getcwd(dst, MAXPATHLEN) == 0) return (0);
while (*dp != '\0') dp++;
*dp++ = DIRSEP;
@ -584,7 +584,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
case '\0':
/* "." also means the user's current working directory. */
if (getwd(dst) == 0) return (0);
if (getcwd(dst, MAXPATHLEN) == 0) return (0);
while (*dp != '\0') dp++;
*dp++ = DIRSEP;