/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-1999 University of Maryland at College Park
/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-1999 University of Maryland at College Park
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
- sync_pkt = malloc(sync_pktlen);
- memcpy(sync_pkt, bs->databuf, sync_pktlen);
+ if (sync_pktlen > 0) {
+ sync_pkt = malloc(sync_pktlen);
+ memcpy(sync_pkt, bs->databuf, sync_pktlen);
+ } else {
+ sync_pkt = NULL;
+ }
do {
n = read(bs->fd, bs->databuf, SIZEOF(bs->databuf));
} while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
do {
n = read(bs->fd, bs->databuf, SIZEOF(bs->databuf));
} while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));