>>>>> "walter" == walter harms <[email protected]> writes:

Hi,

 >> +   int fd = argv[1] ? xopen(argv[1], O_RDONLY) : STDIN_FILENO;
 >> +


 walter>        i did not try; but what will happen if argc==1 ?
 walter>        argv[1] should be undefined.

No, argv is afaik guaranteed to be null terminated - E.G. access to
argv[argc] is OK - But you can ofcourse cheat with execve and get argc
== 0, so the below is indeed better.

 walter>        perhaps this is more save
 walter>        (argc > 1) ? xopen(argv[1], O_RDONLY) : STDIN_FILENO;

-- 
Bye, Peter Korsgaard
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to