Git Product home page Git Product logo

Comments (5)

g-rden avatar g-rden commented on August 16, 2024 1

It took me a while but it's very obvious in hindsight.

darkhttpd/darkhttpd.c

Lines 1891 to 1893 in 5031bf1

if (strcmp((*((const struct dlent * const *)a))->name, "..") == 0) {
return -1; /* Special-case ".." to come first. */
}
When the entries get sorted we check if the first argument of the compare function is "..", but we never check if the second argument is "..".

So ".." was never sorted correctly, the ascii value of ".." is small so it happens to be the first entry most of the time.

I am not sure how to do this best. Adding the check for the second argument would be an easy fix, but I am sure there is a better way.

    if (strcmp((*((const struct dlent * const *)b))->name, "..") == 0) {
        return 1;  /* Special-case ".." to come first. */
    }

from darkhttpd.

hhartzer avatar hhartzer commented on August 16, 2024 1

Awesome, thank you for fixing this @g-rden!

from darkhttpd.

g-rden avatar g-rden commented on August 16, 2024

g-rden@914c196
This should be better in every way anyway (i hope). Does it matter that the date for ".." is now not listed? It could be added but afaik this is the normal way to display it anyway. For example https://dl-cdn.alpinelinux.org/alpine/

from darkhttpd.

hhartzer avatar hhartzer commented on August 16, 2024

Very nice find! I'm good with that.

from darkhttpd.

emikulic avatar emikulic commented on August 16, 2024

I don't mind about the date. :)

from darkhttpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.