SCCS-vsn: usr.bin/write/write.c 4.13
-static char *sccsid = "@(#)write.c 4.12 %G%";
+static char *sccsid = "@(#)write.c 4.13 %G%";
#endif
/*
* write to another user
#endif
/*
* write to another user
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 ((stbuf.st_mode&020) == 0) {
fprintf(stderr,
"write: You have write permission turned off\n");
if (!suser)
fprintf(stderr,
"write: You have write permission turned off\n");
if (!suser)
if (histty[0]==0)
strcpy(histty, ttybuf);
if (access(ttybuf, 0) < 0 || stat(ttybuf, &stbuf) < 0 ||
if (histty[0]==0)
strcpy(histty, ttybuf);
if (access(ttybuf, 0) < 0 || stat(ttybuf, &stbuf) < 0 ||
- (stbuf.st_mode&02) == 0)
+ (stbuf.st_mode&020) == 0)
nomesg++;
else {
strcpy(histty, ttybuf);
nomesg++;
else {
strcpy(histty, ttybuf);
goto out;
}
if (i == 0) {
goto out;
}
if (i == 0) {
+ fclose(tf); /* Close his terminal */
+ setgid(getgid()); /* Give up effective group privs */
sigs((int (*)())0);
execl(getenv("SHELL") ?
getenv("SHELL") : "/bin/sh", "sh", "-c", bp+1, 0);
sigs((int (*)())0);
execl(getenv("SHELL") ?
getenv("SHELL") : "/bin/sh", "sh", "-c", bp+1, 0);