* [9fans] /sys/src/cmd/chmod.c
@ 2003-12-31 14:32 Lucio De Re
2003-12-31 15:25 ` Martin Harriss
2004-01-05 11:03 ` Zhen Lin
0 siblings, 2 replies; 4+ messages in thread
From: Lucio De Re @ 2003-12-31 14:32 UTC (permalink / raw)
To: 9fans mailing list
This struck me, looking at recent changes to chmod(1) which allow one
to flag a file as "not to be included in nightly archives":
for(; *s ; s++){
switch(*s){
case 'r':
mode |= A(DMREAD); break;
case 'w':
mode |= A(DMWRITE); break;
case 'x':
mode |= A(DMEXEC); break;
case 'a':
mode |= DMAPPEND; break;
case 'l':
mode |= DMEXCL; break;
case 't':
mode |= DMTMP; break;
default:
return 0;
}
}
if(*s != 0)
return 0;
I can't see how *s can be non-zero on exit from the for loop. Is
my C programming _so_ rusty?!
++L
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] /sys/src/cmd/chmod.c
2003-12-31 14:32 [9fans] /sys/src/cmd/chmod.c Lucio De Re
@ 2003-12-31 15:25 ` Martin Harriss
2004-01-05 11:03 ` Zhen Lin
1 sibling, 0 replies; 4+ messages in thread
From: Martin Harriss @ 2003-12-31 15:25 UTC (permalink / raw)
To: 9fans
Defensive programming?
Martin
Lucio De Re wrote:
> This struck me, looking at recent changes to chmod(1) which allow one
> to flag a file as "not to be included in nightly archives":
>
> for(; *s ; s++){
> switch(*s){
> case 'r':
> mode |= A(DMREAD); break;
> case 'w':
> mode |= A(DMWRITE); break;
> case 'x':
> mode |= A(DMEXEC); break;
> case 'a':
> mode |= DMAPPEND; break;
> case 'l':
> mode |= DMEXCL; break;
> case 't':
> mode |= DMTMP; break;
> default:
> return 0;
> }
> }
> if(*s != 0)
> return 0;
>
> I can't see how *s can be non-zero on exit from the for loop. Is
> my C programming _so_ rusty?!
>
> ++L
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] /sys/src/cmd/chmod.c
2003-12-31 14:32 [9fans] /sys/src/cmd/chmod.c Lucio De Re
2003-12-31 15:25 ` Martin Harriss
@ 2004-01-05 11:03 ` Zhen Lin
2004-01-05 15:26 ` ron minnich
1 sibling, 1 reply; 4+ messages in thread
From: Zhen Lin @ 2004-01-05 11:03 UTC (permalink / raw)
To: 9fans
lucio@proxima.alt.za (Lucio De Re) wrote in message news:<20031231163240.Z25949@cackle.proxima.alt.za>...
> I can't see how *s can be non-zero on exit from the for loop. Is
> my C programming _so_ rusty?!
>
> ++L
Evil, non-synchronised write into *s? Magic cosmic rays? Anything
could happen to anything.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-01-05 15:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-31 14:32 [9fans] /sys/src/cmd/chmod.c Lucio De Re
2003-12-31 15:25 ` Martin Harriss
2004-01-05 11:03 ` Zhen Lin
2004-01-05 15:26 ` ron minnich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).