493 |
} else { |
} else { |
494 |
|
|
495 |
#ifndef HAVE_GETCWD |
#ifndef HAVE_GETCWD |
496 |
perror("boa: getcwd() not defined. Aborting."); |
perror("%s: getcwd() not defined. Aborting.", SERVER_NAME); |
497 |
exit(1); |
exit(1); |
498 |
#endif |
#endif |
499 |
if (getcwd(dirbuf, DIRBUF_SIZE) == NULL) { |
if (getcwd(dirbuf, DIRBUF_SIZE) == NULL) { |
500 |
if (errno == ERANGE) |
if (errno == ERANGE) |
501 |
perror |
perror |
502 |
("boa: getcwd() failed - unable to get working directory. " |
(SERVER_NAME": getcwd() failed - unable to get working directory. " |
503 |
"Aborting."); |
"Aborting."); |
504 |
else if (errno == EACCES) |
else if (errno == EACCES) |
505 |
perror("boa: getcwd() failed - No read access in current " |
perror(SERVER_NAME": getcwd() failed - No read access in current " |
506 |
"directory. Aborting."); |
"directory. Aborting."); |
507 |
else |
else |
508 |
perror("boa: getcwd() failed - unknown error. Aborting."); |
perror(SERVER_NAME": getcwd() failed - unknown error. Aborting."); |
509 |
exit(1); |
exit(1); |
510 |
} |
} |
511 |
|
|
513 |
len1 = strlen(dirbuf); |
len1 = strlen(dirbuf); |
514 |
len2 = strlen(path); |
len2 = strlen(path); |
515 |
if (len1 + len2 > MAX_PATH_LENGTH * 2) { |
if (len1 + len2 > MAX_PATH_LENGTH * 2) { |
516 |
perror("boa: eek. unable to normalize pathname"); |
perror(SERVER_NAME": eek. unable to normalize pathname"); |
517 |
exit(1); |
exit(1); |
518 |
} |
} |
519 |
if (strcmp(path,".") != 0) { |
if (strcmp(path,".") != 0) { |
520 |
memcpy(dirbuf + len1, "/", 1); |
memcpy(dirbuf + len1, "/", 1); |
521 |
memcpy(dirbuf + len1 + 1, path, len2 + 1); |
memcpy(dirbuf + len1 + 1, path, len2 + 1); |
522 |
} |
} |
523 |
/* fprintf(stderr, "boa: normalize gets \"%s\"\n", dirbuf); */ |
/* fprintf(stderr, "%s: normalize gets \"%s\"\n", SERVER_NAME, dirbuf); */ |
524 |
|
|
525 |
endpath = strdup(dirbuf); |
endpath = strdup(dirbuf); |
526 |
} |
} |
527 |
|
|
528 |
if (endpath == NULL) { |
if (endpath == NULL) { |
529 |
fprintf(stderr, |
fprintf(stderr, |
530 |
"boa: Cannot strdup path. Aborting.\n"); |
"%s: Cannot strdup path. Aborting.\n", SERVER_NAME); |
531 |
exit(1); |
exit(1); |
532 |
} |
} |
533 |
return endpath; |
return endpath; |