From c679a49aac2102188e6da47428397516e12450f2 Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Mon, 19 Nov 2018 18:12:13 -0400 Subject: [PATCH] Added patch from Samuel Thibault to make project compile on Hurd branch of Debian. --- doc/Changelog | 3 +++ src/consoles.c | 5 +++-- src/sulogin.c | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index d6dca21..f9526b5 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -58,6 +58,9 @@ sysvinit (2.92) unreleased; urgency=low where we are talking about an initscript called halt or the halt program. Likewise whether we are talking about the shutdown process or the specific shutdown program. + Should address Debian bug #374039. + * Added patch from Samuel Thibault to make project compile + on Hurd branch of Debian. sysvinit (2.91) world; urgency=low diff --git a/src/consoles.c b/src/consoles.c index 9d3538e..f5e8732 100644 --- a/src/consoles.c +++ b/src/consoles.c @@ -159,7 +159,7 @@ char* scandev(DIR *dir) fd = dirfd(dir); rewinddir(dir); while ((dent = readdir(dir))) { - char path[PATH_MAX]; + char *path; struct stat st; if (fstatat(fd, dent->d_name, &st, 0) < 0) continue; @@ -167,9 +167,10 @@ char* scandev(DIR *dir) continue; if (comparedev != st.st_rdev) continue; - if ((size_t)snprintf(path, sizeof(path), "/dev/%s", dent->d_name) >= sizeof(path)) + if (asprintf(&path, "/dev/%s", dent->d_name) < 0) continue; name = realpath(path, NULL); + free(path); break; } return name; diff --git a/src/sulogin.c b/src/sulogin.c index e46b11a..612f7e7 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -144,7 +144,9 @@ void tcinit(struct console *con) cfsetispeed(tio, ispeed); cfsetospeed(tio, ospeed); +#ifndef __GNU__ tio->c_line = 0; +#endif tio->c_cc[VTIME] = 0; tio->c_cc[VMIN] = 1; @@ -203,7 +205,7 @@ void tcinit(struct console *con) tio->c_cc[VEOF] = CEOF; # ifdef VSWTC tio->c_cc[VSWTC] = _POSIX_VDISABLE; -# else +# elif defined(VSWTCH) tio->c_cc[VSWTCH] = _POSIX_VDISABLE; # endif tio->c_cc[VSTART] = CSTART; @@ -261,7 +263,7 @@ void tcfinal(struct console *con) tio->c_cc[VEOF] = CEOF; #ifdef VSWTC tio->c_cc[VSWTC] = _POSIX_VDISABLE; -#else +#elif defined(VSWTCH) tio->c_cc[VSWTCH] = _POSIX_VDISABLE; #endif tio->c_cc[VSTART] = CSTART;