emikulic / darkhttpd

When you need a web server in a hurry.
https://unix4lyfe.org/darkhttpd/
ISC License
1.05k stars 87 forks source link

Compile error (patched sources) #2

Closed tieugene closed 3 years ago

tieugene commented 3 years ago

Building on CentOS7 from scratch:

darkhttpd.c: In function 'base64_encode':
darkhttpd.c:969:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0, j = 0; i < input_length;) {
     ^
darkhttpd.c:969:5: note: use option -std=c99 or -std=gnu99 to compile your code
darkhttpd.c:984:14: error: redefinition of 'i'
     for (int i = 0; i < mod_table[input_length % 3]; i++)
              ^
darkhttpd.c:969:14: note: previous definition of 'i' was here
     for (int i = 0, j = 0; i < input_length;) {
              ^
darkhttpd.c:984:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0; i < mod_table[input_length % 3]; i++)
     ^
error: Bad exit status from /var/tmp/rpm-tmp.uQUaKJ (%build)
    Bad exit status from /var/tmp/rpm-tmp.uQUaKJ (%build)
emikulic commented 3 years ago

Thanks for pointing this out, I wouldn't have found out otherwise. All of the rest of the code is C90 so I fixed the two lines in question. :)