]> www.dolda2000.com Git - ashd.git/commitdiff
sendfile: Only use encoded variants if they're smaller than the original.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 20 Jan 2026 21:48:21 +0000 (22:48 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 20 Jan 2026 21:48:21 +0000 (22:48 +0100)
src/compress.c

index e03760f0a42d20b9c07badabb39e467e804e8bdd..6154687259ee9013618fd4b70bb0499e5da0f388 100644 (file)
@@ -270,7 +270,7 @@ int ccopen(char *path, struct stat *sb, char *accept, const char **encoding)
     for(i = 0; i < types.d; i++) {
        if((type = findtype(types.b[i])) != NULL) {
            if((efd = openbytype(type, fd, sb, &esb)) >= 0) {
-               if((mfd < 0) || (esb.st_size < minsz)) {
+               if((esb.st_size < sb->st_size) && ((mfd < 0) || (esb.st_size < minsz))) {
                    if(mfd >= 0)
                        close(mfd);
                    mfd = efd;