mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-10-31 11:07:44 +00:00
common.c common.h udlgs.c udlunix.c:
Replace use of getwd(3) with getcwd(3); it's safer.
This commit is contained in:
parent
96970e3e76
commit
25acdd5de9
@ -4,7 +4,7 @@
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -860,7 +860,7 @@ char *Mktemp(const char *base)
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* __GNO__ */
|
||||
|
||||
return st;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -93,11 +93,6 @@ extern char *get_path(const char *name);
|
||||
|
||||
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__)
|
||||
extern char getopt(int, char **, char *);
|
||||
#endif
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -252,7 +252,7 @@ int main(int argc, char **argv) {
|
||||
else {
|
||||
|
||||
/* save the directory we're in */
|
||||
if (getwd(rootdir)==NULL) {
|
||||
if (getcwd(rootdir, MAXPATHLEN)==NULL) {
|
||||
fprintf(stderr,"%s: Couldn't stat .\n",program_name);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
@ -134,8 +134,9 @@ int main(int argc,char *argv[]) {
|
||||
}
|
||||
|
||||
/* save the directory we're in */
|
||||
if (getwd(rootdir)==NULL) {
|
||||
fprintf(stderr,"%s: Couldn't stat .\n",program_name);
|
||||
if (getcwd(rootdir, MAXPATHLEN)==NULL) {
|
||||
fprintf(stderr,"%s: getcwd failed for .: %s\n",
|
||||
program_name, strerror(errno));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user