httpd: round down sendfile byte count to 64k
*: style fixes
This commit is contained in:
parent
f5635f4d32
commit
319f8ebef8
@ -45,7 +45,7 @@ static unsigned julian;
|
|||||||
/* leap year -- account for Gregorian reformation in 1752 */
|
/* leap year -- account for Gregorian reformation in 1752 */
|
||||||
static int leap_year(unsigned yr)
|
static int leap_year(unsigned yr)
|
||||||
{
|
{
|
||||||
if (yr <= 1752)
|
if (yr <= 1752)
|
||||||
return !(yr % 4);
|
return !(yr % 4);
|
||||||
return (!(yr % 4) && (yr % 100)) || !(yr % 400);
|
return (!(yr % 4) && (yr % 100)) || !(yr % 400);
|
||||||
}
|
}
|
||||||
|
@ -475,8 +475,8 @@ static action*** parse_params(char **argv)
|
|||||||
"-o\0"
|
"-o\0"
|
||||||
USE_FEATURE_FIND_NOT( "!\0" )
|
USE_FEATURE_FIND_NOT( "!\0" )
|
||||||
#if ENABLE_DESKTOP
|
#if ENABLE_DESKTOP
|
||||||
"-and\0"
|
"-and\0"
|
||||||
"-or\0"
|
"-or\0"
|
||||||
USE_FEATURE_FIND_NOT( "-not\0" )
|
USE_FEATURE_FIND_NOT( "-not\0" )
|
||||||
#endif
|
#endif
|
||||||
"-print\0"
|
"-print\0"
|
||||||
@ -487,7 +487,7 @@ static action*** parse_params(char **argv)
|
|||||||
USE_FEATURE_FIND_EXEC( "-exec\0" )
|
USE_FEATURE_FIND_EXEC( "-exec\0" )
|
||||||
USE_FEATURE_FIND_PAREN( "(\0" )
|
USE_FEATURE_FIND_PAREN( "(\0" )
|
||||||
/* All options starting from here require argument */
|
/* All options starting from here require argument */
|
||||||
"-name\0"
|
"-name\0"
|
||||||
USE_FEATURE_FIND_PATH( "-path\0" )
|
USE_FEATURE_FIND_PATH( "-path\0" )
|
||||||
USE_FEATURE_FIND_REGEX( "-regex\0" )
|
USE_FEATURE_FIND_REGEX( "-regex\0" )
|
||||||
USE_FEATURE_FIND_TYPE( "-type\0" )
|
USE_FEATURE_FIND_TYPE( "-type\0" )
|
||||||
|
@ -16,7 +16,7 @@ int ttysize_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
unsigned w,h;
|
unsigned w,h;
|
||||||
struct winsize wsz;
|
struct winsize wsz;
|
||||||
|
|
||||||
w = 80;
|
w = 80;
|
||||||
h = 24;
|
h = 24;
|
||||||
if (!ioctl(0, TIOCGWINSZ, &wsz)) {
|
if (!ioctl(0, TIOCGWINSZ, &wsz)) {
|
||||||
|
@ -1395,7 +1395,8 @@ static int sendFile(const char *url)
|
|||||||
fd++; /* write to fd #1 in inetd mode */
|
fd++; /* write to fd #1 in inetd mode */
|
||||||
#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
|
#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
|
||||||
do {
|
do {
|
||||||
count = sendfile(fd, f, &offset, MAXINT(ssize_t));
|
/* byte count is rounded down to 64k */
|
||||||
|
count = sendfile(fd, f, &offset, MAXINT(ssize_t) - 0xffff);
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
@ -75,7 +75,7 @@ static const char runcon_longopts[] ALIGN1 =
|
|||||||
"type\0" Required_argument "t"
|
"type\0" Required_argument "t"
|
||||||
"range\0" Required_argument "l"
|
"range\0" Required_argument "l"
|
||||||
"compute\0" No_argument "c"
|
"compute\0" No_argument "c"
|
||||||
"help\0" No_argument "h"
|
"help\0" No_argument "h"
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user