/[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.4 by nmav, Wed Sep 25 19:55:53 2002 UTC revision 1.5 by nmav, Fri Sep 27 21:09:11 2002 UTC
# Line 432  int boa_atoi(const char *s) Line 432  int boa_atoi(const char *s)
432      return retval;      return retval;
433  }  }
434    
435    /* returns -1 on error */
436  int create_temporary_file(short want_unlink, char *storage, int size)  int create_temporary_file(short want_unlink, char *storage, int size)
437  {  {
438      char boa_tempfile[MAX_PATH_LENGTH + 1];      char boa_tempfile[MAX_PATH_LENGTH + 1];
# Line 445  int create_temporary_file(short want_unl Line 446  int create_temporary_file(short want_unl
446      if (fd == -1) {      if (fd == -1) {
447          log_error_time();          log_error_time();
448          perror("mkstemp");          perror("mkstemp");
449          return 0;          return -1;
450      }      }
451    
452      if (storage != NULL) {      if (storage != NULL) {
# Line 455  int create_temporary_file(short want_unl Line 456  int create_temporary_file(short want_unl
456              memcpy(storage, boa_tempfile, len + 1);              memcpy(storage, boa_tempfile, len + 1);
457          } else {          } else {
458              close(fd);              close(fd);
459              fd = 0;              fd = -1;
460              log_error_time();              log_error_time();
461              fprintf(stderr, "not enough memory for memcpy in storage\n");              fprintf(stderr, "not enough memory for memcpy in storage\n");
462              want_unlink = 1;              want_unlink = 1;
# Line 465  int create_temporary_file(short want_unl Line 466  int create_temporary_file(short want_unl
466      if (want_unlink) {      if (want_unlink) {
467          if (unlink(boa_tempfile) == -1) {          if (unlink(boa_tempfile) == -1) {
468              close(fd);              close(fd);
469              fd = 0;              fd = -1;
470              log_error_time();              log_error_time();
471              fprintf(stderr, "unlink temp file\n");              fprintf(stderr, "unlink temp file\n");
472          }          }

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26