From 25acdd5de968d83a6929f23a8adcd07265d93f19 Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Fri, 15 Jan 1999 07:36:15 +0000 Subject: [PATCH] common.c common.h udlgs.c udlunix.c: Replace use of getwd(3) with getcwd(3); it's safer. --- usr.orca.bin/udl/common.c | 4 ++-- usr.orca.bin/udl/common.h | 7 +------ usr.orca.bin/udl/udlgs.c | 4 ++-- usr.orca.bin/udl/udlunix.c | 7 ++++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/usr.orca.bin/udl/common.c b/usr.orca.bin/udl/common.c index b9ef339..0700473 100644 --- a/usr.orca.bin/udl/common.c +++ b/usr.orca.bin/udl/common.c @@ -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; } diff --git a/usr.orca.bin/udl/common.h b/usr.orca.bin/udl/common.h index 765659f..d940390 100644 --- a/usr.orca.bin/udl/common.h +++ b/usr.orca.bin/udl/common.h @@ -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 diff --git a/usr.orca.bin/udl/udlgs.c b/usr.orca.bin/udl/udlgs.c index 341bd9b..49bc6d4 100644 --- a/usr.orca.bin/udl/udlgs.c +++ b/usr.orca.bin/udl/udlgs.c @@ -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); } diff --git a/usr.orca.bin/udl/udlunix.c b/usr.orca.bin/udl/udlunix.c index 13dda97..928804f 100644 --- a/usr.orca.bin/udl/udlunix.c +++ b/usr.orca.bin/udl/udlunix.c @@ -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); }