SCCS-vsn: usr.bin/write/write.c 4.10
-static char *sccsid = "@(#)write.c 4.9 %G%";
+static char *sccsid = "@(#)write.c 4.10 %G%";
#endif
/*
* write to another user
#endif
/*
* write to another user
register FILE *uf;
int c1, c2;
long clock = time(0);
register FILE *uf;
int c1, c2;
long clock = time(0);
+ int suser = getuid() == 0;
struct tm *localtime();
struct tm *localclock = localtime( &clock );
struct tm *localtime();
struct tm *localclock = localtime( &clock );
perror("write: Can't stat your tty");
exit(1);
}
perror("write: Can't stat your tty");
exit(1);
}
- if ((stbuf.st_mode&02) == 0) {
+ if (!suser && (stbuf.st_mode&02) == 0) {
fprintf(stderr,
"write: You have write permission turned off\n");
exit(1);
fprintf(stderr,
"write: You have write permission turned off\n");
exit(1);
alarm(0);
if (fstat(fileno(tf), &stbuf) < 0)
goto perm;
alarm(0);
if (fstat(fileno(tf), &stbuf) < 0)
goto perm;
- if ((stbuf.st_mode&02) == 0)
+ if (!suser && (stbuf.st_mode&02) == 0)
goto perm;
sigs(eof);
{ char hostname[32];
goto perm;
sigs(eof);
{ char hostname[32];