Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Missing handling of "close" errors
When backing up on a CIFS target (others?), a full (remote) file system
is not detected until close() returns (returning -1 and setting errno).
However, the return value is not verified, and the incorrect write
operation is not detected. The final job result is "ok", but the volume
files are small or empty.

Fixes #233: Missing handling of "close" errors

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
Bastian Friedrich authored and Marco van Wieringen committed Oct 13, 2013
1 parent ffed4b0 commit b27b544
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stored/dev.c
Expand Up @@ -1713,15 +1713,15 @@ void DEVICE::clear_volhdr()
*/
void DEVICE::close(DCR *dcr)
{
int status;
Dmsg1(100, "close_dev %s\n", print_name());

if (!norewindonclose) {
offline_or_rewind();
}

if (!is_open()) {
Dmsg2(100, "device %s already closed vol=%s\n", print_name(),
VolHdr.VolumeName);
Dmsg2(100, "device %s already closed vol=%s\n", print_name(), VolHdr.VolumeName);
return; /* already closed */
}

Expand All @@ -1732,7 +1732,13 @@ void DEVICE::close(DCR *dcr)
unlock_door();
/* Fall through wanted */
default:
d_close(m_fd);
status = d_close(m_fd);
if (status < 0) {
berrno be;

Mmsg2(errmsg, _("Unable to close device %s. ERR=%s\n"), print_name(), be.bstrerror());
Jmsg(dcr->jcr, M_FATAL, 0, errmsg);
}
break;
}

Expand Down

0 comments on commit b27b544

Please sign in to comment.