* this routine, it will not add the token. It is not clear what
* is going on here! So we will do the following operation.
* On AIX 5, it causes the parent program to die, so we won't.
+ * We don't care about the return value, but need to collect it
+ * to avoid compiler warnings.
*/
- write(2,"",0); /* dummy write */
+ if (write(2,"",0) < 0) /* dummy write */
+ ; /* don't care */
#endif
token_setPag(token, afssetpag);
status = ktc_SetTokenEx(token);
/* do the ioctl call */
ioctl_rc = USD_IOCTL(fd, USD_IOCTL_TAPEOPERATION, (void *)&tapeop);
- /* send the return code back to the parent */
- write(pipefd[1], &ioctl_rc, sizeof(int));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &ioctl_rc, sizeof(int)) < 0)
+ ; /* don't care */
exit(0);
} else { /* parent process */
USD_CLOSE(fd);
}
- /* send the return code back to the parent */
- write(pipefd[1], &open_rc, sizeof(open_rc));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &open_rc, sizeof(open_rc)) < 0)
+ ; /* don't care */
exit(0);
} else { /* parent process */
}
}
- /* the parent writes the control pipe after it closes the device */
- read(ctlpipe[0], &close_rc, sizeof(int));
+ /*
+ * The parent writes the control pipe after it closes the device.
+ * We don't actually care about the read; we're just using it to
+ * block until the parent is ready. But we must do something
+ * with the result, to avoid complier warnings on some platforms.
+ */
+ if (read(ctlpipe[0], &close_rc, sizeof(int)) < 0)
+ ; /* don't care */
close(ctlpipe[0]);
/* do the close */
close_rc = USD_CLOSE(fd);
- /* send the return code back to the parent */
- write(pipefd[1], &close_rc, sizeof(int));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &close_rc, sizeof(int)) < 0)
+ ; /* don't care */
exit(0);
} else { /* parent process */
void
rxi_flushtrace(void)
{
- if (rxi_logfd >= 0)
- write(rxi_logfd, rxi_tracebuf, rxi_tracepos);
+ afs_uint32 len = rxi_tracepos;
+
rxi_tracepos = 0;
+ if (rxi_logfd < 0)
+ return;
+ if (write(rxi_logfd, rxi_tracebuf, len) < 0)
+ ; /* don't care */
}
void
WriteLogBuffer(char *buf, afs_uint32 len)
{
LOCK_SERVERLOG();
- if (serverLogFD > 0)
- (void)write(serverLogFD, buf, len);
+ if (serverLogFD > 0) {
+ if (write(serverLogFD, buf, len) < 0)
+ ; /* don't care */
+ }
UNLOCK_SERVERLOG();
}
syslog(LOG_INFO, "%s", info);
} else
#endif
- if (serverLogFD > 0)
- (void)write(serverLogFD, tbuffer, len);
+ if (serverLogFD > 0) {
+ if (write(serverLogFD, tbuffer, len) < 0)
+ ; /* don't care */
+ }
UNLOCK_SERVERLOG();
#if !defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
return -1;
}
/* redirect stdout and stderr so random printf's don't write to data */
- (void)freopen(fileName, "a", stdout);
- (void)freopen(fileName, "a", stderr);
+ if (freopen(fileName, "a", stdout) == NULL)
+ ; /* don't care */
+ if (freopen(fileName, "a", stderr) != NULL) {
#ifdef HAVE_SETVBUF
- setvbuf(stderr, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
#else
- setbuf(stderr, NULL);
+ setbuf(stderr, NULL);
#endif
+ }
#if defined(AFS_PTHREAD_ENV)
opr_Verify(pthread_mutex_init(&serverLogMutex, NULL) == 0);
close(serverLogFD);
serverLogFD = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
if (serverLogFD > 0) {
- (void)freopen(fileName, "a", stdout);
- (void)freopen(fileName, "a", stderr);
+ if (freopen(fileName, "a", stdout) == NULL)
+ ; /* don't care */
+ if (freopen(fileName, "a", stderr) != NULL) {
#ifdef HAVE_SETVBUF
#ifdef SETVBUF_REVERSED
- setvbuf(stderr, _IONBF, NULL, 0);
+ setvbuf(stderr, _IONBF, NULL, 0);
#else
- setvbuf(stderr, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
#endif
#else
- setbuf(stderr, NULL);
+ setbuf(stderr, NULL);
#endif
+ }
}
UNLOCK_SERVERLOG();
if (SawLock)
plock(PROCLOCK);
#elif !defined(AFS_NT40_ENV)
- nice(-5); /* TODO: */
+ if (nice(-5) < 0)
+ ; /* don't care */
#endif
DInit(buffs);
#ifdef AFS_DEMAND_ATTACH_FS
/* try to link the logfile to a timestamped filename */
/* if it fails, oh well, nothing we can do */
- link(log_path, stampSlvgLog);
+ if (link(log_path, stampSlvgLog))
+ ; /* oh well */
}
#endif
fprintf(STDOUT, "First test point - operation not started.\n");
fprintf(STDOUT, "...test here (y, n)? ");
fflush(STDOUT);
- fscanf(stdin, "%c", &in);
- fscanf(stdin, "%c", &lf); /* toss away */
+ if (fscanf(stdin, "%c", &in) < 1)
+ in = 0;
+ if (fscanf(stdin, "%c", &lf) < 0) /* toss away */
+ ; /* don't care */
if (in == 'y') {
fprintf(STDOUT, "type control-c\n");
while (1) {
"Second test point - operation in progress but not complete.\n");
fprintf(STDOUT, "...test here (y, n)? ");
fflush(STDOUT);
- fscanf(stdin, "%c", &in);
- fscanf(stdin, "%c", &lf); /* toss away */
+ if (fscanf(stdin, "%c", &in) < 1)
+ in = 0;
+ if (fscanf(stdin, "%c", &lf) < 0) /* toss away */
+ ; /* don't care */
if (in == 'y') {
fprintf(STDOUT, "type control-c\n");
while (1) {
"Third test point - operation complete but no cleanup.\n");
fprintf(STDOUT, "...test here (y, n)? ");
fflush(STDOUT);
- fscanf(stdin, "%c", &in);
- fscanf(stdin, "%c", &lf); /* toss away */
+ if (fscanf(stdin, "%c", &in) < 1)
+ in = 0;
+ if (fscanf(stdin, "%c", &lf) < 0) /* toss away */
+ ; /* don't care */
if (in == 'y') {
fprintf(STDOUT, "type control-c\n");
while (1) {
fprintf(STDOUT, "Fourth test point - operation complete.\n");
fprintf(STDOUT, "...test here (y, n)? ");
fflush(STDOUT);
- fscanf(stdin, "%c", &in);
- fscanf(stdin, "%c", &lf); /* toss away */
+ if (fscanf(stdin, "%c", &in) < 1)
+ in = 0;
+ if (fscanf(stdin, "%c", &lf) < 0) /* toss away */
+ ; /* don't care */
if (in == 'y') {
fprintf(STDOUT, "type control-c\n");
while (1) {