projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3c0b1d8
)
FDIO: don't set fd's to 0, -1 is better since its safe for abuse.
author
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 17 Aug 2013 10:14:57 +0000
(12:14 +0200)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sat, 17 Aug 2013 10:14:57 +0000
(12:14 +0200)
libcitadel/lib/stringbuf.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index 9bc1c8eb04aa9015ab7f5d62abdd50fe5b2d0175..1b9ea072366221b9bea1f8cf1f438a229f795bb3 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-3934,9
+3934,17
@@
long IOBufferStrLength(IOBuffer *FB)
return StrLength(FB->Buf) - (FB->ReadWritePointer - FB->Buf->buf);
}
return StrLength(FB->Buf) - (FB->ReadWritePointer - FB->Buf->buf);
}
-
void FDIOBufferInit(FDIOBuffer *FDB, IOBuffer *IO, int FD, long TotalSendSize
)
+
inline static void FDIOBufferFlush(FDIOBuffer *FDB
)
{
memset(FDB, 0, sizeof(FDIOBuffer));
{
memset(FDB, 0, sizeof(FDIOBuffer));
+ FDB->OtherFD = -1;
+ FDB->SplicePipe[0] = -1;
+ FDB->SplicePipe[1] = -1;
+}
+
+void FDIOBufferInit(FDIOBuffer *FDB, IOBuffer *IO, int FD, long TotalSendSize)
+{
+ FDIOBufferFlush(FDB);
FDB->ChunkSize =
FDB->TotalSendSize = TotalSendSize;
FDB->IOB = IO;
FDB->ChunkSize =
FDB->TotalSendSize = TotalSendSize;
FDB->IOB = IO;
@@
-3966,7
+3974,7
@@
void FDIOBufferDelete(FDIOBuffer *FDB)
if (FDB->OtherFD > 0)
close(FDB->OtherFD);
if (FDB->OtherFD > 0)
close(FDB->OtherFD);
- memset(FDB, 0, sizeof(FDIOBuffer));
+ FDIOBufferFlush(FDB);
}
int FileSendChunked(FDIOBuffer *FDB, const char **Err)
}
int FileSendChunked(FDIOBuffer *FDB, const char **Err)