common.c common.h udlgs.c udlunix.c:

Replace use of getwd(3) with getcwd(3); it's safer.
This commit is contained in:
gdr-ftp 1999-01-15 07:36:15 +00:00
parent 96970e3e76
commit 25acdd5de9
4 changed files with 9 additions and 13 deletions

View File

@ -4,7 +4,7 @@
* *
* Routines common to both the Unix and Apple IIgs versions. * Routines common to both the Unix and Apple IIgs versions.
* *
* $Id: common.c,v 1.10 1997/12/08 16:07:19 gdr Exp $ * $Id: common.c,v 1.11 1999/01/15 07:36:15 gdr-ftp Exp $
* *
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade * Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/ */
@ -860,7 +860,7 @@ char *Mktemp(const char *base)
fclose(fp); fclose(fp);
} }
} }
#endif #endif /* __GNO__ */
return st; return st;
} }

View File

@ -4,7 +4,7 @@
* *
* Header file for routines common to both the Unix and Apple IIgs versions. * Header file for routines common to both the Unix and Apple IIgs versions.
* *
* $Id: common.h,v 1.9 1996/02/04 01:34:27 gdr Exp $ * $Id: common.h,v 1.10 1999/01/15 07:36:15 gdr-ftp Exp $
* *
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade * Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/ */
@ -93,11 +93,6 @@ extern char *get_path(const char *name);
extern int needsgno(void); extern int needsgno(void);
/* not strictly necessary, but it cuts down on warnings from gcc */
#if defined(__GNUC__) || defined(_AIX)
extern char *getwd(char *);
#endif
#if defined (__GNUC__) && !defined (__DJGPP__) #if defined (__GNUC__) && !defined (__DJGPP__)
extern char getopt(int, char **, char *); extern char getopt(int, char **, char *);
#endif #endif

View File

@ -4,7 +4,7 @@
* *
* Apple IIgs specific routines. * Apple IIgs specific routines.
* *
* $Id: udlgs.c,v 1.12 1997/12/19 07:48:16 gdr Exp $ * $Id: udlgs.c,v 1.13 1999/01/15 07:36:15 gdr-ftp Exp $
* *
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade * Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/ */
@ -252,7 +252,7 @@ int main(int argc, char **argv) {
else { else {
/* save the directory we're in */ /* save the directory we're in */
if (getwd(rootdir)==NULL) { if (getcwd(rootdir, MAXPATHLEN)==NULL) {
fprintf(stderr,"%s: Couldn't stat .\n",program_name); fprintf(stderr,"%s: Couldn't stat .\n",program_name);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }

View File

@ -4,7 +4,7 @@
* *
* Unix specific routines. * Unix specific routines.
* *
* $Id: udlunix.c,v 1.10 1997/08/02 21:09:13 gdr Exp $ * $Id: udlunix.c,v 1.11 1999/01/15 07:36:15 gdr-ftp Exp $
* *
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade * Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/ */
@ -134,8 +134,9 @@ int main(int argc,char *argv[]) {
} }
/* save the directory we're in */ /* save the directory we're in */
if (getwd(rootdir)==NULL) { if (getcwd(rootdir, MAXPATHLEN)==NULL) {
fprintf(stderr,"%s: Couldn't stat .\n",program_name); fprintf(stderr,"%s: getcwd failed for .: %s\n",
program_name, strerror(errno));
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }