From 0977f32648d744fc15d63b49c1bd0420e99b4bec Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sun, 5 Nov 2000 01:50:30 +0000 Subject: [PATCH] replace-getwd-with-getcwd-20001104 getcwd replaces getwd --- src/ftpd43+/ftpd.c | 5 ++++- src/sys/rmtsysc.c | 5 ++++- src/venus/test/fulltest.c | 6 +++++- src/volser/restorevol.c | 10 +++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ftpd43+/ftpd.c b/src/ftpd43+/ftpd.c index 054d26a50..a67c2729a 100644 --- a/src/ftpd43+/ftpd.c +++ b/src/ftpd43+/ftpd.c @@ -1737,8 +1737,11 @@ removedir(name) pwd() { char path[MAXPATHLEN + 1]; +#if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */ extern char *getwd(); - if (getwd(path) == (char *)NULL) +#define getcwd(x,y) getwd(x) +#endif + if (getcwd(path, MAXPATHLEN+1) == (char *)NULL) reply(550, "%s.", path); else reply(257, "\"%s\" is current directory.", path); diff --git a/src/sys/rmtsysc.c b/src/sys/rmtsysc.c index bd0abdd92..e83238946 100644 --- a/src/sys/rmtsysc.c +++ b/src/sys/rmtsysc.c @@ -204,7 +204,10 @@ struct ViceIoctl *data; afs_int32 errorcode, groups[NGROUPS_MAX], errornumber, ins= data->in_size; rmtbulk InData, OutData; char pathname[256], *pathp = pathname, *inbuffer; +#if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */ extern char *getwd(); +#define getcwd(x,y) getwd(x) +#endif if (!(conn = rx_connection(&errorcode, "pioctl"))) { /* Remote call can't be performed for some reason. * Try the local 'pioctl' system call ... */ @@ -230,7 +233,7 @@ struct ViceIoctl *data; if (path) { if (*path != '/') { /* assuming relative path name */ - if (getwd(pathname) == NULL) { + if (getcwd(pathname, 256) == NULL) { free(inbuffer); printf("getwd failed; exiting\n"); exit(1); diff --git a/src/venus/test/fulltest.c b/src/venus/test/fulltest.c index e06572189..3b59a06d1 100644 --- a/src/venus/test/fulltest.c +++ b/src/venus/test/fulltest.c @@ -25,13 +25,17 @@ char **argv; { struct timeval tvp[2]; int fd1; int code; +#ifndef HAVE_GETCWD + extern char *getwd(); +#define getcwd(x,y) getwd(x) +#endif /* venus system tester */ if (argc != 2) return printf("usage: fulltest \n"); dirName = argv[1]; mkdir(dirName, 0777); if (chdir(dirName) < 0) return perror("chdir"); - if (getwd(tempName) == 0) { + if (getcwd(tempName, 1024) == 0) { return printf("Could not get working dir.\n"); } /* now create some files */ diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index e6d33a3fe..19fd8e3e2 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -746,6 +746,10 @@ WorkerBee(as, arock) char fname[MAXNAMELEN], name[MAXNAMELEN], lname[MAXNAMELEN], mname[MAXNAMELEN]; char thisdir[MAXPATHLEN], *t; struct DumpHeader dh; /* Defined in dump.h */ +#if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */ + extern char *getwd(); +#define getcwd(x,y) getwd(x) +#endif if (as->parms[0].items) { /* -file */ dumpfile = fopen(as->parms[0].items->data, "r"); @@ -793,7 +797,7 @@ WorkerBee(as, arock) * or -dir or the current working dir. */ if ((as->parms[3].items) || (as->parms[1].items)) { /* -mountpoint or -dir*/ - t = (char *)getwd(thisdir); /* remember current dir */ + t = (char *)getcwd(thisdir, MAXPATHLEN); /* remember current dir */ if (!t) { fprintf(stderr, "Cannot get pathname of current working directory: %s\n", thisdir); @@ -807,7 +811,7 @@ WorkerBee(as, arock) fprintf(stderr, "Mount point directory not found: Error = %d\n", stderr); goto cleanup; } - t = (char *)getwd(mntroot); /* get its full pathname */ + t = (char *)getcwd(mntroot, MAXPATHLEN); /* get its full pathname */ if (!t) { fprintf(stderr, "Cannot determine pathname of mount point root directory: %s\n", mntroot); @@ -821,7 +825,7 @@ WorkerBee(as, arock) goto cleanup; } } else { /* use current directory */ - t = (char *)getwd(mntroot); /* get full pathname of current dir */ + t = (char *)getcwd(mntroot, MAXPATHLEN); /* get full pathname of current dir */ if (!t) { fprintf(stderr, "Cannot determine pathname of current working directory: %s\n", mntroot); -- 2.39.5