Dolda2000 GitWeb
/
doldaconnect.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve error reporting in dc-qcmd.
[doldaconnect.git]
/
daemon
/
transfer.c
diff --git
a/daemon/transfer.c
b/daemon/transfer.c
index
d364b57
..
e2fe54e
100644
(file)
--- a/
daemon/transfer.c
+++ b/
daemon/transfer.c
@@
-1,6
+1,6
@@
/*
* Dolda Connect - Modular multiuser Direct Connect-style client
/*
* Dolda Connect - Modular multiuser Direct Connect-style client
- * Copyright (C) 2004 Fredrik Tolf
(fredrik@dolda2000.com)
+ * Copyright (C) 2004 Fredrik Tolf
<fredrik@dolda2000.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-292,8
+292,12
@@
void *transfergetdata(struct transfer *transfer, size_t *size)
return(NULL);
if((transfer->endpos >= 0) && (transfer->curpos + *size >= transfer->endpos))
{
return(NULL);
if((transfer->endpos >= 0) && (transfer->curpos + *size >= transfer->endpos))
{
- *size = transfer->endpos - transfer->curpos;
- buf = srealloc(buf, *size);
+ if((*size = transfer->endpos - transfer->curpos) == 0) {
+ free(buf);
+ buf = NULL;
+ } else {
+ buf = srealloc(buf, *size);
+ }
}
transfer->curpos += *size;
bytesupload += *size;
}
transfer->curpos += *size;
bytesupload += *size;