Compare commits
31 Commits
f860767ea0
...
70c5499709
Author | SHA1 | Date |
---|---|---|
Jonas 'Sortie' Termansen | 70c5499709 | |
Jonas 'Sortie' Termansen | 2ccbb69032 | |
Jonas 'Sortie' Termansen | 49e25c1bd4 | |
Jonas 'Sortie' Termansen | b9d8175545 | |
Jonas 'Sortie' Termansen | 0fef08bbc4 | |
Jonas 'Sortie' Termansen | b304e34d56 | |
Jonas 'Sortie' Termansen | 40e3432faf | |
Jonas 'Sortie' Termansen | 9ba552a1b5 | |
Jonas 'Sortie' Termansen | 54f99f8269 | |
Jonas 'Sortie' Termansen | 263a1ec1f1 | |
Jonas 'Sortie' Termansen | 2d8f7bc57a | |
Jonas 'Sortie' Termansen | 5948a2be00 | |
Jonas 'Sortie' Termansen | 2f36596b6d | |
Jonas 'Sortie' Termansen | 7e0555f2c2 | |
Jonas 'Sortie' Termansen | 8730de52de | |
Jonas 'Sortie' Termansen | 3eeab1d368 | |
Jonas 'Sortie' Termansen | 8990553795 | |
Jonas 'Sortie' Termansen | fb76556f95 | |
Jonas 'Sortie' Termansen | d9aef1d8d9 | |
Jonas 'Sortie' Termansen | 72814b830c | |
Jonas 'Sortie' Termansen | 4a455be70a | |
Jonas 'Sortie' Termansen | 0305241095 | |
Jonas 'Sortie' Termansen | ef75110afb | |
Jonas 'Sortie' Termansen | 0482958335 | |
Jonas 'Sortie' Termansen | f6257155cc | |
Jonas 'Sortie' Termansen | d93fb760d5 | |
Jonas 'Sortie' Termansen | ee5f69c0c3 | |
Jonas 'Sortie' Termansen | bb570bbbf2 | |
Jonas 'Sortie' Termansen | 42a8e34e80 | |
Jonas 'Sortie' Termansen | 60471c9f52 | |
Jonas 'Sortie' Termansen | 4227cbfa94 |
|
@ -2549,7 +2549,7 @@ static void write_random_seed(void)
|
||||||
{
|
{
|
||||||
const char* will_not = "next boot will not have fresh randomness";
|
const char* will_not = "next boot will not have fresh randomness";
|
||||||
const char* path = "/boot/random.seed";
|
const char* path = "/boot/random.seed";
|
||||||
int fd = open(path, O_RDWR | O_CREAT | O_NOFOLLOW, 0600);
|
int fd = open(path, O_WRONLY | O_CREAT | O_NOFOLLOW, 0600);
|
||||||
if ( fd < 0 )
|
if ( fd < 0 )
|
||||||
{
|
{
|
||||||
if ( errno != ENOENT && errno != EROFS )
|
if ( errno != ENOENT && errno != EROFS )
|
||||||
|
@ -2568,10 +2568,6 @@ static void write_random_seed(void)
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Mix in the old random seed so the sysadmin can add new randomness here.
|
|
||||||
unsigned char old[256] = {0};
|
|
||||||
readall(fd, old, sizeof(old));
|
|
||||||
lseek(fd, 0, SEEK_SET);
|
|
||||||
// Write out randomness, but mix in some fresh kernel randomness in case the
|
// Write out randomness, but mix in some fresh kernel randomness in case the
|
||||||
// randomness used to seed arc4random didn't have enough entropy, there may
|
// randomness used to seed arc4random didn't have enough entropy, there may
|
||||||
// be more now.
|
// be more now.
|
||||||
|
@ -2580,7 +2576,7 @@ static void write_random_seed(void)
|
||||||
unsigned char newbuf[256];
|
unsigned char newbuf[256];
|
||||||
getentropy(newbuf, sizeof(newbuf));
|
getentropy(newbuf, sizeof(newbuf));
|
||||||
for ( size_t i = 0; i < 256; i++ )
|
for ( size_t i = 0; i < 256; i++ )
|
||||||
buf[i] ^= newbuf[i] ^ old[i];
|
buf[i] ^= newbuf[i];
|
||||||
size_t done = writeall(fd, buf, sizeof(buf));
|
size_t done = writeall(fd, buf, sizeof(buf));
|
||||||
explicit_bzero(buf, sizeof(buf));
|
explicit_bzero(buf, sizeof(buf));
|
||||||
if ( done < sizeof(buf) )
|
if ( done < sizeof(buf) )
|
||||||
|
|
|
@ -268,7 +268,7 @@ size_t STRFTIME(STRFTIME_CHAR* s,
|
||||||
continue;
|
continue;
|
||||||
case STRFTIME_L('h'): OUTPUT_STRING(GetMonthAbbreviated(tm)); break;
|
case STRFTIME_L('h'): OUTPUT_STRING(GetMonthAbbreviated(tm)); break;
|
||||||
case STRFTIME_L('H'): OUTPUT_INT_PADDED(tm->tm_hour, 2, STRFTIME_L('0')); break; /*O*/
|
case STRFTIME_L('H'): OUTPUT_INT_PADDED(tm->tm_hour, 2, STRFTIME_L('0')); break; /*O*/
|
||||||
case STRFTIME_L('I'): OUTPUT_INT_PADDED((tm->tm_hour + 11) % 12 + 1, 2, STRFTIME_L('0')); break; /*O*/
|
case STRFTIME_L('I'): OUTPUT_INT_PADDED(tm->tm_hour % 12 + 1, 2, STRFTIME_L('0')); break; /*O*/
|
||||||
case STRFTIME_L('j'): OUTPUT_INT_PADDED(tm->tm_yday + 1, 3, STRFTIME_L('0')); break;
|
case STRFTIME_L('j'): OUTPUT_INT_PADDED(tm->tm_yday + 1, 3, STRFTIME_L('0')); break;
|
||||||
case STRFTIME_L('m'): OUTPUT_INT_PADDED(tm->tm_mon + 1, 2, STRFTIME_L('0')); break; /*O*/
|
case STRFTIME_L('m'): OUTPUT_INT_PADDED(tm->tm_mon + 1, 2, STRFTIME_L('0')); break; /*O*/
|
||||||
case STRFTIME_L('M'): OUTPUT_INT_PADDED(tm->tm_min, 2, STRFTIME_L('0')); break; /*O*/
|
case STRFTIME_L('M'): OUTPUT_INT_PADDED(tm->tm_min, 2, STRFTIME_L('0')); break; /*O*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2014, 2015, 2016 Jonas 'Sortie' Termansen.
|
||||||
* Copyright (c) 2021 Juhani 'nortti' Krekelä.
|
* Copyright (c) 2021 Juhani 'nortti' Krekelä.
|
||||||
* Copyright (c) 2023 dzwdz.
|
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -88,8 +87,6 @@ static inline void arrow_initialize()
|
||||||
|
|
||||||
static struct textbox textbox_username;
|
static struct textbox textbox_username;
|
||||||
static struct textbox textbox_password;
|
static struct textbox textbox_password;
|
||||||
static char* username = NULL;
|
|
||||||
static char* session = NULL;
|
|
||||||
|
|
||||||
struct glogin
|
struct glogin
|
||||||
{
|
{
|
||||||
|
@ -658,7 +655,7 @@ static void think(struct glogin* state)
|
||||||
}
|
}
|
||||||
if ( result )
|
if ( result )
|
||||||
{
|
{
|
||||||
if ( !login(username, session) )
|
if ( !login(textbox_username.text) )
|
||||||
state->warning = strerror(errno);
|
state->warning = strerror(errno);
|
||||||
state->stage = STAGE_USERNAME;
|
state->stage = STAGE_USERNAME;
|
||||||
textbox_reset(&textbox_username);
|
textbox_reset(&textbox_username);
|
||||||
|
@ -679,28 +676,24 @@ static void keyboard_event(struct glogin* state, uint32_t codepoint)
|
||||||
{
|
{
|
||||||
if ( codepoint == '\n' )
|
if ( codepoint == '\n' )
|
||||||
{
|
{
|
||||||
enum special_action action;
|
|
||||||
state->warning = NULL;
|
state->warning = NULL;
|
||||||
switch ( state->stage )
|
switch ( state->stage )
|
||||||
{
|
{
|
||||||
case STAGE_USERNAME:
|
case STAGE_USERNAME:
|
||||||
free(username);
|
if ( !strcmp(textbox_username.text, "exit") )
|
||||||
free(session);
|
exit(0);
|
||||||
username = NULL;
|
if ( !strcmp(textbox_username.text, "poweroff") )
|
||||||
session = NULL;
|
exit(0);
|
||||||
if ( !parse_username(textbox_username.text, &username,
|
if ( !strcmp(textbox_username.text, "reboot") )
|
||||||
&session, &action) )
|
exit(1);
|
||||||
{
|
if ( !strcmp(textbox_username.text, "halt") )
|
||||||
state->warning = "Invalid username";
|
exit(2);
|
||||||
break;
|
|
||||||
}
|
|
||||||
handle_special(action);
|
|
||||||
state->stage = STAGE_PASSWORD;
|
state->stage = STAGE_PASSWORD;
|
||||||
textbox_reset(&textbox_password);
|
textbox_reset(&textbox_password);
|
||||||
break;
|
break;
|
||||||
case STAGE_PASSWORD:
|
case STAGE_PASSWORD:
|
||||||
state->stage = STAGE_CHECKING;
|
state->stage = STAGE_CHECKING;
|
||||||
if ( !check_begin(&state->chk, username,
|
if ( !check_begin(&state->chk, textbox_username.text,
|
||||||
textbox_password.text, true) )
|
textbox_password.text, true) )
|
||||||
{
|
{
|
||||||
state->stage = STAGE_USERNAME;
|
state->stage = STAGE_USERNAME;
|
||||||
|
|
|
@ -34,9 +34,6 @@ script if it exists and is executable, otherwise attempting
|
||||||
.Pa /etc/session ,
|
.Pa /etc/session ,
|
||||||
and ultimately falling back on the user's shell from
|
and ultimately falling back on the user's shell from
|
||||||
.Xr passwd 5 .
|
.Xr passwd 5 .
|
||||||
It can be overriden by suffixing the username with a colon and the name of the
|
|
||||||
program to launch.
|
|
||||||
If the program name is skipped, the login shell is launched.
|
|
||||||
.Pp
|
.Pp
|
||||||
Type a special username to perform special options:
|
Type a special username to perform special options:
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, 2018, 2022 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2014, 2015, 2018, 2022 Jonas 'Sortie' Termansen.
|
||||||
* Copyright (c) 2023 dzwdz.
|
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -203,7 +201,7 @@ static int setcloexecfrom(int from)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool login(const char* username, const char* session)
|
bool login(const char* username)
|
||||||
{
|
{
|
||||||
char login_pid[sizeof(pid_t) * 3];
|
char login_pid[sizeof(pid_t) * 3];
|
||||||
snprintf(login_pid, sizeof(login_pid), "%" PRIiPID, getpid());
|
snprintf(login_pid, sizeof(login_pid), "%" PRIiPID, getpid());
|
||||||
|
@ -219,8 +217,6 @@ bool login(const char* username, const char* session)
|
||||||
char* login_shell;
|
char* login_shell;
|
||||||
if ( asprintf(&login_shell, "-%s", pwd->pw_shell) < 0 )
|
if ( asprintf(&login_shell, "-%s", pwd->pw_shell) < 0 )
|
||||||
return close(pipe_fds[0]), close(pipe_fds[1]), false;
|
return close(pipe_fds[0]), close(pipe_fds[1]), false;
|
||||||
if ( session && *session == '\0' )
|
|
||||||
session = login_shell;
|
|
||||||
sigset_t oldset, sigttou;
|
sigset_t oldset, sigttou;
|
||||||
sigemptyset(&sigttou);
|
sigemptyset(&sigttou);
|
||||||
sigaddset(&sigttou, SIGTTOU);
|
sigaddset(&sigttou, SIGTTOU);
|
||||||
|
@ -256,14 +252,11 @@ bool login(const char* username, const char* session)
|
||||||
tcsetpgrp(0, getpgid(0)) ||
|
tcsetpgrp(0, getpgid(0)) ||
|
||||||
sigprocmask(SIG_SETMASK, &oldset, NULL) < 0 ||
|
sigprocmask(SIG_SETMASK, &oldset, NULL) < 0 ||
|
||||||
settermmode(0, TERMMODE_NORMAL) < 0 ||
|
settermmode(0, TERMMODE_NORMAL) < 0 ||
|
||||||
(session ?
|
|
||||||
execlp(session + (session[0] == '-'), session, (const char*) NULL) < 0
|
|
||||||
:
|
|
||||||
(execlp("./.session", "./.session", (const char*) NULL) < 0 &&
|
(execlp("./.session", "./.session", (const char*) NULL) < 0 &&
|
||||||
errno != ENOENT && errno != EACCES) ||
|
errno != ENOENT && errno != EACCES) ||
|
||||||
(execlp("/etc/session", "/etc/session", (const char*) NULL) < 0 &&
|
(execlp("/etc/session", "/etc/session", (const char*) NULL) < 0 &&
|
||||||
errno != ENOENT && errno != EACCES) ||
|
errno != ENOENT && errno != EACCES) ||
|
||||||
execlp(pwd->pw_shell, login_shell, (const char*) NULL)));
|
execlp(pwd->pw_shell, login_shell, (const char*) NULL));
|
||||||
write(pipe_fds[1], &errno, sizeof(errno));
|
write(pipe_fds[1], &errno, sizeof(errno));
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
@ -325,61 +318,6 @@ static bool read_terminal_line(char* buffer, size_t size)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse_username(const char* input,
|
|
||||||
char** username,
|
|
||||||
char** session,
|
|
||||||
enum special_action* action)
|
|
||||||
{
|
|
||||||
*username = NULL;
|
|
||||||
*session = NULL;
|
|
||||||
*action = SPECIAL_ACTION_NONE;
|
|
||||||
if ( !strcmp(input, "exit") )
|
|
||||||
return *action = SPECIAL_ACTION_POWEROFF, true;
|
|
||||||
else if ( !strcmp(input, "poweroff") )
|
|
||||||
return *action = SPECIAL_ACTION_POWEROFF, true;
|
|
||||||
else if ( !strcmp(input, "reboot") )
|
|
||||||
return *action = SPECIAL_ACTION_REBOOT, true;
|
|
||||||
else if ( !strcmp(input, "halt") )
|
|
||||||
return *action = SPECIAL_ACTION_HALT, true;
|
|
||||||
|
|
||||||
// Skip leading spaces to allow logging in as special accounts.
|
|
||||||
while ( isspace(*input) )
|
|
||||||
input++;
|
|
||||||
char* colon = strchr(input, ':');
|
|
||||||
if ( !colon )
|
|
||||||
{
|
|
||||||
*username = strdup(input);
|
|
||||||
return *username != NULL;
|
|
||||||
}
|
|
||||||
if ( strchr(colon + 1, ':') )
|
|
||||||
{
|
|
||||||
// Input contains more than one colon.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*username = strndup(input, colon - input);
|
|
||||||
if ( !*username )
|
|
||||||
return false;
|
|
||||||
*session = strdup(colon + 1);
|
|
||||||
if ( !*session )
|
|
||||||
{
|
|
||||||
free(*username);
|
|
||||||
*username = NULL;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_special(enum special_action action)
|
|
||||||
{
|
|
||||||
switch ( action )
|
|
||||||
{
|
|
||||||
case SPECIAL_ACTION_NONE: return;
|
|
||||||
case SPECIAL_ACTION_POWEROFF: exit(0);
|
|
||||||
case SPECIAL_ACTION_REBOOT: exit(1);
|
|
||||||
case SPECIAL_ACTION_HALT: exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int textual(void)
|
int textual(void)
|
||||||
{
|
{
|
||||||
unsigned int termmode = TERMMODE_UNICODE | TERMMODE_SIGNAL | TERMMODE_UTF8 |
|
unsigned int termmode = TERMMODE_UNICODE | TERMMODE_SIGNAL | TERMMODE_UTF8 |
|
||||||
|
@ -388,9 +326,6 @@ int textual(void)
|
||||||
err(2, "settermmode");
|
err(2, "settermmode");
|
||||||
unsigned int pw_termmode = termmode & ~(TERMMODE_ECHO);
|
unsigned int pw_termmode = termmode & ~(TERMMODE_ECHO);
|
||||||
|
|
||||||
char* username = NULL;
|
|
||||||
char* session = NULL;
|
|
||||||
|
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
char hostname[HOST_NAME_MAX + 1];
|
char hostname[HOST_NAME_MAX + 1];
|
||||||
|
@ -398,9 +333,9 @@ int textual(void)
|
||||||
gethostname(hostname, sizeof(hostname));
|
gethostname(hostname, sizeof(hostname));
|
||||||
printf("%s login: ", hostname);
|
printf("%s login: ", hostname);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
char input[256];
|
char username[256];
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ( !read_terminal_line(input, sizeof(input)) )
|
if ( !read_terminal_line(username, sizeof(username)) )
|
||||||
{
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
if ( errno && errno != EINTR )
|
if ( errno && errno != EINTR )
|
||||||
|
@ -412,17 +347,14 @@ int textual(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum special_action action;
|
if ( !strcmp(username, "exit") )
|
||||||
free(username);
|
exit(0);
|
||||||
free(session);
|
if ( !strcmp(username, "poweroff") )
|
||||||
username = NULL;
|
exit(0);
|
||||||
session = NULL;
|
if ( !strcmp(username, "reboot") )
|
||||||
if ( !parse_username(input, &username, &session, &action) )
|
exit(1);
|
||||||
{
|
if ( !strcmp(username, "halt") )
|
||||||
printf("Invalid username\n\n");
|
exit(2);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
handle_special(action);
|
|
||||||
|
|
||||||
if ( settermmode(0, pw_termmode) < 0 )
|
if ( settermmode(0, pw_termmode) < 0 )
|
||||||
err(2, "settermmode");
|
err(2, "settermmode");
|
||||||
|
@ -457,10 +389,11 @@ int textual(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !login(username, session) )
|
if ( !login(username) )
|
||||||
{
|
{
|
||||||
warn("logging in as %s", username);
|
warn("logging in as %s", username);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015 Jonas 'Sortie' Termansen.
|
* Copyright (c) 2014, 2015 Jonas 'Sortie' Termansen.
|
||||||
* Copyright (c) 2023 dzwdz.
|
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -36,15 +35,7 @@ struct check
|
||||||
bool pipe_nonblock;
|
bool pipe_nonblock;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum special_action
|
bool login(const char* username);
|
||||||
{
|
|
||||||
SPECIAL_ACTION_NONE,
|
|
||||||
SPECIAL_ACTION_POWEROFF,
|
|
||||||
SPECIAL_ACTION_REBOOT,
|
|
||||||
SPECIAL_ACTION_HALT,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool login(const char* username, const char* session);
|
|
||||||
bool check_real(const char* username, const char* password);
|
bool check_real(const char* username, const char* password);
|
||||||
bool check_begin(struct check* chk,
|
bool check_begin(struct check* chk,
|
||||||
const char* username,
|
const char* username,
|
||||||
|
@ -55,10 +46,4 @@ bool check(const char* username, const char* password);
|
||||||
int graphical(void);
|
int graphical(void);
|
||||||
int textual(void);
|
int textual(void);
|
||||||
|
|
||||||
bool parse_username(const char* input,
|
|
||||||
char** out_username,
|
|
||||||
char** out_session,
|
|
||||||
enum special_action* action);
|
|
||||||
void handle_special(enum special_action action);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -560,6 +560,19 @@ diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_config.h nginx/src/co
|
||||||
|
|
||||||
#define NGX_INT32_LEN (sizeof("-2147483648") - 1)
|
#define NGX_INT32_LEN (sizeof("-2147483648") - 1)
|
||||||
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 1)
|
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 1)
|
||||||
|
diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_inet.c nginx/src/core/ngx_inet.c
|
||||||
|
--- nginx.upstream/src/core/ngx_inet.c
|
||||||
|
+++ nginx/src/core/ngx_inet.c
|
||||||
|
@@ -1130,7 +1130,8 @@
|
||||||
|
ngx_memzero(&hints, sizeof(struct addrinfo));
|
||||||
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
|
-#ifdef AI_ADDRCONFIG
|
||||||
|
+/* PATCH: AI_ADDRCONFIG is defined on Sortix but is unimplemented. */
|
||||||
|
+#if defined(AI_ADDRCONFIG) && !defined(__sortix__)
|
||||||
|
hints.ai_flags = AI_ADDRCONFIG;
|
||||||
|
#endif
|
||||||
|
|
||||||
diff -Paur --no-dereference -- nginx.upstream/src/event/ngx_event.c nginx/src/event/ngx_event.c
|
diff -Paur --no-dereference -- nginx.upstream/src/event/ngx_event.c nginx/src/event/ngx_event.c
|
||||||
--- nginx.upstream/src/event/ngx_event.c
|
--- nginx.upstream/src/event/ngx_event.c
|
||||||
+++ nginx/src/event/ngx_event.c
|
+++ nginx/src/event/ngx_event.c
|
||||||
|
|
|
@ -219,8 +219,9 @@ static void scroll(ssize_t offsigned, struct entry with)
|
||||||
if ( rows < off )
|
if ( rows < off )
|
||||||
off = rows;
|
off = rows;
|
||||||
size_t dist = off * columns;
|
size_t dist = off * columns;
|
||||||
|
size_t start = 0;
|
||||||
size_t end = rows * columns - dist;
|
size_t end = rows * columns - dist;
|
||||||
for ( size_t i = 0; i < end; i++ )
|
for ( size_t i = start; i < end; i++ )
|
||||||
scrollback[i] = scrollback[i + dist];
|
scrollback[i] = scrollback[i + dist];
|
||||||
for ( size_t i = end; i < end + dist; i++ )
|
for ( size_t i = end; i < end + dist; i++ )
|
||||||
scrollback[i] = with;
|
scrollback[i] = with;
|
||||||
|
@ -231,8 +232,9 @@ static void scroll(ssize_t offsigned, struct entry with)
|
||||||
if ( rows < off )
|
if ( rows < off )
|
||||||
off = rows;
|
off = rows;
|
||||||
size_t dist = off * columns;
|
size_t dist = off * columns;
|
||||||
|
size_t start = dist;
|
||||||
size_t end = rows * columns;
|
size_t end = rows * columns;
|
||||||
for ( size_t i = end-1; dist <= i; i-- )
|
for ( size_t i = start; i < end; i++ )
|
||||||
scrollback[i] = scrollback[i - dist];
|
scrollback[i] = scrollback[i - dist];
|
||||||
for ( size_t i = 0; i < dist; i++ )
|
for ( size_t i = 0; i < dist; i++ )
|
||||||
scrollback[i] = with;
|
scrollback[i] = with;
|
||||||
|
|
Loading…
Reference in New Issue