Article View: gnu.utils.bug
Article #1733"can't fail"
From: John Gilmore
Date: Mon, 12 Feb 1990 09:23
Date: Mon, 12 Feb 1990 09:23
23 lines
1354 bytes
1354 bytes
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.
Technical Details
Message-ID:
<10188@hoptoad.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!hoptoad!gnuReferences:
<9002081852.AA00339@zurich.ai.mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: gnu.utils.bug Subject: "can't fail" Message-ID: <10188@hoptoad.uucp> Date: 12 Feb 90 09:23:28 GMT References: <9002081852.AA00339@zurich.ai.mit.edu> Organization: Grasshopper Group in San Francisco Lines: 23