From 403c4e79bbb07a959f6d8668d161604cdbe4e0de Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 23 Mar 2012 00:41:01 +0100 Subject: [PATCH] StrBufStripSlashes() we want to _strip_ trailing slashes, not append them. --- libcitadel/lib/stringbuf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index bc54f82cf..1219401b4 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -3862,7 +3862,6 @@ int FileSendChunked(FDIOBuffer *FDB, const char **Err) int FileRecvChunked(FDIOBuffer *FDB, const char **Err) { - #ifdef LINUX_SENDFILE ssize_t sent, pipesize; @@ -3887,6 +3886,7 @@ int FileRecvChunked(FDIOBuffer *FDB, const char **Err) FDB->ChunkSendRemain -= sent; return sent; #else + #endif return 0; } @@ -4628,9 +4628,10 @@ void StrBufStripSlashes(StrBuf *Dir, int RemoveTrailingSlash) b++; a++; } } - if ((RemoveTrailingSlash) && (*(b - 1) != '/')){ - *b = '/'; - b++; + if ((RemoveTrailingSlash) && + (b > Dir->buf) && + (*(b - 1) == '/')){ + b--; } *b = '\0'; Dir->BufUsed = b - Dir->buf; -- 2.30.2