- Timestamp:
- Feb 24, 2009 4:07:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/show.c
r1785 r2280 401 401 int flags; 402 402 #endif 403 int fd; 403 404 404 405 if (debug(psh) != 1) { … … 430 431 } 431 432 } else { 432 if ((tracefile = fopen(s, "a")) == NULL) { 433 fd = shfile_open(&psh->fdtab, s, O_APPEND | O_RDWR | O_CREAT, 0600); 434 if (fd != -1) { 435 int fd2 = fcntl(fd, F_DUPFD, 199); 436 if (fd2 == -1) 437 fd2 = fcntl(fd, F_DUPFD, 99); 438 if (fd2 == -1) 439 fd2 = fcntl(fd, F_DUPFD, 49); 440 if (fd2 == -1) 441 fd2 = fcntl(fd, F_DUPFD, 18); 442 if (fd2 == -1) 443 fd2 = fcntl(fd, F_DUPFD, 10); 444 if (fd2 != -1) { 445 close(fd); 446 fd = fd2; 447 } 448 } 449 if (fd == -1 || (tracefile = fdopen(fd, "a")) == NULL) { 433 450 fprintf(stderr, "Can't open %s\n", s); 434 451 debug(psh) = 0; … … 436 453 } 437 454 } 438 #if defined(O_APPEND) && !defined(_MSC_VER)439 if ((flags = shfile_fcntl(&psh->fdtab, fileno(tracefile), F_GETFL, 0)) >= 0)440 shfile_fcntl(&psh->fdtab, fileno(tracefile), F_SETFL, flags | O_APPEND);441 #endif442 455 setvbuf(tracefile, (char *)NULL, _IOLBF, 0); //setlinebuf(tracefile); 443 456 fputs("\nTracing started.\n", tracefile);
Note:
See TracChangeset
for help on using the changeset viewer.