replace-getwd-with-getcwd-20001104

getcwd replaces getwd
This commit is contained in:
Derrick Brashear 2000-11-05 01:50:30 +00:00 committed by Derrick Brashear
parent a2daff69dd
commit 0977f32648
4 changed files with 20 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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 <dir-to-screw-up>\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 */

View File

@ -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> */
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);