diff --git a/util-linux-ng-2.22-login-lastlog.patch b/2.23-login-lastlog-create.patch similarity index 87% rename from util-linux-ng-2.22-login-lastlog.patch rename to 2.23-login-lastlog-create.patch index 839193a..6db26e2 100644 --- a/util-linux-ng-2.22-login-lastlog.patch +++ b/2.23-login-lastlog-create.patch @@ -2,11 +2,10 @@ diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-util --- util-linux-2.23.2/login-utils/login.c.kzak 2013-07-30 10:39:26.222738397 +0200 +++ util-linux-2.23.2/login-utils/login.c 2013-09-09 09:01:39.923225757 +0200 @@ -502,7 +502,7 @@ static void log_lastlog(struct login_con - if (!cxt->pwd) - return; - + if (!cxt->pwd) + return; + - fd = open(_PATH_LASTLOG, O_RDWR, 0); + fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); - if (fd < 0) - return; - + if (fd < 0) + return; diff --git a/util-linux-2.23-agetty-clocal.patch b/2.24-agetty-clocal.patch similarity index 68% rename from util-linux-2.23-agetty-clocal.patch rename to 2.24-agetty-clocal.patch index 9e83e70..c7e6f66 100644 --- a/util-linux-2.23-agetty-clocal.patch +++ b/2.24-agetty-clocal.patch @@ -2,13 +2,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils --- util-linux-2.23.2/term-utils/agetty.c.kzak 2013-07-30 11:14:18.124912322 +0200 +++ util-linux-2.23.2/term-utils/agetty.c 2013-09-09 09:07:46.406689270 +0200 @@ -132,13 +132,20 @@ struct options { - int delay; /* Sleep seconds before prompt */ - int nice; /* Run login with this priority */ - int numspeed; /* number of baud rates to try */ + int delay; /* Sleep seconds before prompt */ + int nice; /* Run login with this priority */ + int numspeed; /* number of baud rates to try */ + int clocal; /* CLOCAL_MODE_* */ - speed_t speeds[MAX_SPEED]; /* baud rates to be tried */ + speed_t speeds[MAX_SPEED]; /* baud rates to be tried */ }; - + +enum { + CLOCAL_MODE_AUTO = 0, + CLOCAL_MODE_ALWAYS, @@ -25,7 +25,7 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils #define F_CUSTISSUE (1<<6) /* give alternative issue file */ @@ -235,10 +242,13 @@ static void login_options_to_argv(char * static char *fakehost; - + #ifdef DEBUGGING -#define debug(s) do { fprintf(dbf,s); fflush(dbf); } while (0) +# ifndef DEBUG_OUTPUT @@ -40,53 +40,53 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils int main(int argc, char **argv) @@ -270,7 +280,7 @@ int main(int argc, char **argv) - sigaction(SIGINT, &sa, &sa_int); - + sigaction(SIGINT, &sa, &sa_int); + #ifdef DEBUGGING - dbf = fopen("/dev/ttyp0", "w"); + dbf = fopen(DEBUG_OUTPUT, "w"); - for (int i = 1; i < argc; i++) - debug(argv[i]); + for (int i = 1; i < argc; i++) + debug(argv[i]); #endif /* DEBUGGING */ @@ -311,8 +321,10 @@ int main(int argc, char **argv) - strlen(options.initstring)); - } - + strlen(options.initstring)); + } + - if (!serial_tty_option(&options, F_LOCAL)) - /* Go to blocking write mode unless -L is specified. */ + if (options.flags & F_VCONSOLE || options.clocal != CLOCAL_MODE_ALWAYS) + /* Go to blocking mode unless -L is specified, this change + * affects stdout, stdin and stderr as all the file descriptors + * are created by dup(). */ - fcntl(STDOUT_FILENO, F_SETFL, - fcntl(STDOUT_FILENO, F_GETFL, 0) & ~O_NONBLOCK); - + fcntl(STDOUT_FILENO, F_SETFL, + fcntl(STDOUT_FILENO, F_GETFL, 0) & ~O_NONBLOCK); + @@ -420,6 +432,12 @@ int main(int argc, char **argv) - options.tty); - } - + options.tty); + } + +#ifdef DEBUGGING + fprintf(dbf, "read %c\n", ch); + if (close_stream(dbf) != 0) + log_err("write failed: %s", DEBUG_OUTPUT); +#endif + - /* Let the login program take care of password validation. */ - execv(options.login, login_argv); - log_err(_("%s: can't exec %s: %m"), options.tty, login_argv[0]); + /* Let the login program take care of password validation. */ + execv(options.login, login_argv); + log_err(_("%s: can't exec %s: %m"), options.tty, login_argv[0]); @@ -534,7 +552,7 @@ static void parse_args(int argc, char ** - { "init-string", required_argument, 0, 'I' }, - { "noclear", no_argument, 0, 'J' }, - { "login-program", required_argument, 0, 'l' }, + { "init-string", required_argument, 0, 'I' }, + { "noclear", no_argument, 0, 'J' }, + { "login-program", required_argument, 0, 'l' }, - { "local-line", no_argument, 0, 'L' }, + { "local-line", optional_argument, 0, 'L' }, - { "extract-baud", no_argument, 0, 'm' }, - { "skip-login", no_argument, 0, 'n' }, - { "nonewline", no_argument, 0, 'N' }, + { "extract-baud", no_argument, 0, 'm' }, + { "skip-login", no_argument, 0, 'n' }, + { "nonewline", no_argument, 0, 'N' }, @@ -603,7 +621,18 @@ static void parse_args(int argc, char ** - op->login = optarg; - break; - case 'L': + op->login = optarg; + break; + case 'L': - op->flags |= F_LOCAL; + /* -L and -L=always have the same meaning */ + op->clocal = CLOCAL_MODE_ALWAYS; @@ -100,13 +100,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils + else + log_err(_("unssuported --local-line mode argument")); + } - break; - case 'm': - op->flags |= F_PARSE; + break; + case 'm': + op->flags |= F_PARSE; @@ -1090,8 +1119,19 @@ static void termio_init(struct options * - cfsetispeed(tp, ispeed); - cfsetospeed(tp, ospeed); - + cfsetispeed(tp, ispeed); + cfsetospeed(tp, ospeed); + - if (op->flags & F_LOCAL) - tp->c_cflag |= CLOCAL; + /* The default is to follow setting from kernel, but it's possible @@ -123,27 +123,27 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils + } + #ifdef HAVE_STRUCT_TERMIOS_C_LINE - tp->c_line = 0; + tp->c_line = 0; #endif @@ -1412,9 +1452,10 @@ static char *get_logname(struct options - - if (read(STDIN_FILENO, &c, 1) < 1) { - + + if (read(STDIN_FILENO, &c, 1) < 1) { + - /* Do not report trivial like EINTR/EIO errors. */ + /* The terminal could be open with O_NONBLOCK when + * -L (force CLOCAL) is specified... */ - if (errno == EINTR || errno == EAGAIN) { + if (errno == EINTR || errno == EAGAIN) { - usleep(1000); + usleep(250000); - continue; - } - switch (errno) { + continue; + } + switch (errno) { @@ -1648,7 +1689,7 @@ static void __attribute__ ((__noreturn__ - fputs(_(" -i, --noissue do not display issue file\n"), out); - fputs(_(" -I, --init-string set init string\n"), out); - fputs(_(" -l, --login-program specify login program\n"), out); + fputs(_(" -i, --noissue do not display issue file\n"), out); + fputs(_(" -I, --init-string set init string\n"), out); + fputs(_(" -l, --login-program specify login program\n"), out); - fputs(_(" -L, --local-line force local line\n"), out); + fputs(_(" -L, --local-line[=] cotrol local line flag\n"), out); - fputs(_(" -m, --extract-baud extract baud rate during connect\n"), out); - fputs(_(" -n, --skip-login do not prompt for login\n"), out); - fputs(_(" -o, --login-options options that are passed to login\n"), out); + fputs(_(" -m, --extract-baud extract baud rate during connect\n"), out); + fputs(_(" -n, --skip-login do not prompt for login\n"), out); + fputs(_(" -o, --login-options options that are passed to login\n"), out); diff --git a/util-linux.spec b/util-linux.spec index 075e97e..5c84b50 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -75,10 +75,10 @@ Requires: libmount = %{version}-%{release} ### Ready for upstream? ### # 151635 - makeing /var/log/lastlog -Patch0: util-linux-ng-2.22-login-lastlog.patch +Patch0: 2.23-login-lastlog-create.patch ### Backport from v2.24 + #972457 -Patch1: util-linux-2.23-agetty-clocal.patch +Patch1: 2.24-agetty-clocal.patch %description The util-linux package contains a large variety of low-level system @@ -796,7 +796,7 @@ fi %changelog * Mon Sep 9 2013 Karel Zak 2.23.2-3 -- refresh patches +- refresh and rename patches * Thu Aug 1 2013 Karel Zak 2.23.2-2 - fix 990083 - su doesn't work with pam_ecryptfs