*/
/*
- Copyright (C) 2000-2005 Kern Sibbald
+ Copyright (C) 2000-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
head->abfname = bufimode ? NULL : fname;
head->ablineno = (sm_ushort) lineno;
/* Emplace end-clobber detector at end of buffer */
- buf[nbytes - 1] = (((long) buf) & 0xFF) ^ 0xC5;
+ buf[nbytes - 1] = (uint8_t)((((long) buf) & 0xFF) ^ 0xC5);
buf += HEAD_SIZE; /* Increment to user data start */
if (++sm_buffers > sm_max_buffers) {
sm_max_buffers = sm_buffers;
V(mutex);
Emsg2(M_ABORT, 0, _("Buffer overrun called from %s:%d\n"), file, line);
}
- sm_buffers--;
- sm_bytes -= head->ablen;
+ if (sm_buffers > 0) {
+ sm_buffers--;
+ sm_bytes -= head->ablen;
+ }
qdchain(qp);
V(mutex);
return NULL from realloc() and leave the buffer in PTR
intact. */
- sm_buffers--;
- sm_bytes -= osize;
+// sm_buffers--;
+// sm_bytes -= head->ablen;
if ((buf = smalloc(fname, lineno, size)) != NULL) {
memcpy(buf, ptr, (int) sm_min(size, osize));