/[hydra]/hydra/src/util.c
ViewVC logotype

Diff of /hydra/src/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by nmav, Mon Sep 23 12:48:59 2002 UTC revision 1.4 by nmav, Wed Sep 25 19:55:53 2002 UTC
# Line 493  char * normalize_path(char *path) Line 493  char * normalize_path(char *path)
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    
# Line 513  char * normalize_path(char *path) Line 513  char * normalize_path(char *path)
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;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26