don't complain if packet radio interface doesn't support fseek().

This commit is contained in:
gardners 2013-02-15 04:02:19 +10:30 committed by Jeremy Lakeman
parent f2025cd601
commit a42c685715

View File

@ -751,10 +751,14 @@ overlay_broadcast_ensemble(overlay_interface *interface,
only purpose is to find out the offset to print in the DEBUG statement. It is vulnerable
to a race condition with other processes appending to the same file. */
off_t fsize = lseek(interface->alarm.poll.fd, (off_t) 0, SEEK_END);
if (fsize == -1)
return WHY_perror("lseek");
if (config.debug.overlayinterfaces)
DEBUGF("Write to interface %s at offset=%d", interface->name, fsize);
/* Don't complain if the seek fails because we are writing to a pipe or device that does
not support seeking. */
if (errno!=ESPIPE) {
if (fsize == -1)
return WHY_perror("lseek");
if (config.debug.overlayinterfaces)
DEBUGF("Write to interface %s at offset=%d", interface->name, fsize);
}
ssize_t nwrite = write(interface->alarm.poll.fd, &packet, sizeof(packet));
if (nwrite == -1)
return WHY_perror("write");