gnu@hoptoad.uucp (John Gilmore) (02/12/90)
In a code fragment posted as part of a misguided hp-ux patch (add #ifdef hpux everywhere ifdef USG already was -- ecch) I found the following code from cp.c: > #ifdef USG > chmod (to, stbf.st_mode & 0777); /* again, can't fail */ > #else > fchmod (ofd, stbf.st_mode & 0777); /* again, can't fail */ What does "can't fail" mean in this context? Does it mean that if it *does* fail, we will not detect the problem? Does it mean that the program has no bugs? No, it means that the programmer was lazy. At best it means the programmer had no imagination. I can think of ways to make this fail. ERROR RETURNS FROM SYSTEM CALLS MUST ALWAYS BE CHECKED! If the rest of the file utils are written like this, they need some work before it can be claimed that they are 'better' than the Unix versions they're intended to replace. -- John Gilmore {sun,pacbell,uunet,pyramid}!hoptoad!gnu gnu@toad.com Just say *yes* to drugs. If someone offers you a drug war, just say no.