- Timestamp:
- Dec 25, 2008 7:10:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ash/show.c
r809 r2140 47 47 #include <stdarg.h> 48 48 #include <stdlib.h> 49 #include <sys/fcntl.h> 50 #include <unistd.h> 49 51 50 52 #include "shell.h" … … 385 387 int flags; 386 388 #endif 389 #if 1 390 int fd; 391 #endif 387 392 388 393 if (debug != 1) { … … 413 418 return; 414 419 } 420 trace("opentrace: fno=%d - freopen\n", fileno(tracefile)); 415 421 } else { 422 #if 0 416 423 if ((tracefile = fopen(s, "a")) == NULL) { 424 #else 425 fd = open(s, O_APPEND | O_RDWR | O_CREAT, 0600); 426 if (fd != -1) { 427 int fd2 = fcntl(fd, F_DUPFD, 199); 428 if (fd2 == -1) 429 fd2 = fcntl(fd, F_DUPFD, 99); 430 if (fd2 == -1) 431 fd2 = fcntl(fd, F_DUPFD, 49); 432 if (fd2 == -1) 433 fd2 = fcntl(fd, F_DUPFD, 18); 434 if (fd2 == -1) 435 fd2 = fcntl(fd, F_DUPFD, 10); 436 if (fd2 != -1) { 437 close(fd); 438 fd = fd2; 439 } 440 } 441 if (fd == -1 || (tracefile = fdopen(fd, "a")) == NULL) { 442 #endif 417 443 fprintf(stderr, "Can't open %s\n", s); 418 444 debug = 0; 419 445 return; 420 446 } 447 trace("opentrace: fno=%d\n", fileno(tracefile)); 421 448 } 422 449 #ifdef O_APPEND
Note:
See TracChangeset
for help on using the changeset viewer.