Refactor wallmsg() slightly, fixes "unused value" found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
e8674a8fd7
commit
3cff584621
@ -1960,16 +1960,17 @@ void wallmsg(struct filed *f, struct iovec *iov, int iovcnt)
|
|||||||
if (setjmp(ttybuf) == 0) {
|
if (setjmp(ttybuf) == 0) {
|
||||||
(void)signal(SIGALRM, endtty);
|
(void)signal(SIGALRM, endtty);
|
||||||
(void)alarm(15);
|
(void)alarm(15);
|
||||||
|
|
||||||
/* open the terminal */
|
/* open the terminal */
|
||||||
ttyf = open(p, O_WRONLY | O_NOCTTY);
|
ttyf = open(p, O_WRONLY | O_NOCTTY);
|
||||||
if (ttyf >= 0) {
|
if (ttyf >= 0) {
|
||||||
struct stat statb;
|
struct stat st;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (fstat(ttyf, &statb) == 0 &&
|
rc = fstat(ttyf, &st);
|
||||||
(statb.st_mode & S_IWRITE))
|
if (rc == 0 && (st.st_mode & S_IWRITE))
|
||||||
(void)writev(ttyf, iov, iovcnt);
|
(void)writev(ttyf, iov, iovcnt);
|
||||||
close(ttyf);
|
close(ttyf);
|
||||||
ttyf = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)alarm(0);
|
(void)alarm(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user