From 353ecc79dae24a45ab45b41e4c79caa646aeee99 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 1 Sep 2009 11:49:38 +0000 Subject: main/openrc: fix build with 2.6.30 kernel headers --- main/openrc/APKBUILD | 11 ++- main/openrc/command-line-size-fix.patch | 100 +++++++++++++++++++++ .../openrc-0.4.3-command-line-size-fix.patch | 94 +++++++++++++++++++ 3 files changed, 199 insertions(+), 6 deletions(-) create mode 100644 main/openrc/command-line-size-fix.patch create mode 100644 main/openrc/openrc-0.4.3-command-line-size-fix.patch (limited to 'main/openrc') diff --git a/main/openrc/APKBUILD b/main/openrc/APKBUILD index 528e1482f3..f380cb9921 100644 --- a/main/openrc/APKBUILD +++ b/main/openrc/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa pkgname=openrc pkgver=0.5.0 -pkgrel=8 +pkgrel=9 pkgdesc="OpenRC manages the services, startup and shutdown of a host" url="http://roy.marples.name/openrc" license='BSD-2' @@ -10,6 +10,7 @@ subpackages="$pkgname-doc $pkgname-dev" install="$pkgname.post-install $pkgname.post-upgrade" source="http://roy.marples.name/downloads/$pkgname/$pkgname-$pkgver.tar.bz2 dont-provide-ourself.patch + command-line-size-fix.patch openrc-0.4.3-mkmntdirs.patch openrc-hwclock.patch hostname.initd @@ -18,7 +19,6 @@ source="http://roy.marples.name/downloads/$pkgname/$pkgname-$pkgver.tar.bz2 modules.initd modloop.initd networking.initd - $install " build() { @@ -28,7 +28,7 @@ build() { patch -p1 < $i || return 1 done - make + make || return 1 make DESTDIR="$pkgdir/" install # we cannot have anything turned on by default @@ -46,6 +46,7 @@ build() { md5sums="9ec7f8425e12abbbd0f7a962aae3fa3c openrc-0.5.0.tar.bz2 1bb9c2aec9243a781191efcfc68df8c9 dont-provide-ourself.patch +396b1cbd399403ba0448402afc6f9220 command-line-size-fix.patch 8c2c1c2ee0509b63966b7187a2079f4b openrc-0.4.3-mkmntdirs.patch f462c976b04cfbb35b2335be15eee7f6 openrc-hwclock.patch c32e15b0858eef708497e7ee6355a055 hostname.initd @@ -53,6 +54,4 @@ b1e64885f301166df30be3e3cf5338ff hwdrivers.initd 33ca3e558c42cdd17adccbc7807298f7 keymaps.initd 098a1f16812f56fcb56eb6b6f0fa31f6 modules.initd 4c69d1c6a84cbe0195496c14a757579b modloop.initd -747168eee535e845179eaef5a3fcb334 networking.initd -71d823acc9935a8ac82649a94b5bc0b9 openrc.post-install -393ff61bc0bf2c07f9af81795554c584 openrc.post-upgrade" +747168eee535e845179eaef5a3fcb334 networking.initd" diff --git a/main/openrc/command-line-size-fix.patch b/main/openrc/command-line-size-fix.patch new file mode 100644 index 0000000000..77fa2bd810 --- /dev/null +++ b/main/openrc/command-line-size-fix.patch @@ -0,0 +1,100 @@ +diff -ru a/src/librc/librc.h b/src/librc/librc.h +--- a/src/librc/librc.h 2009-09-01 11:42:31.000000000 +0000 ++++ b/src/librc/librc.h 2009-09-01 11:42:47.000000000 +0000 +@@ -72,8 +72,6 @@ + #define librc_hidden_proto(x) hidden_proto(x) + #define librc_hidden_def(x) hidden_def(x) + +-ssize_t rc_getline(char **, size_t *, FILE *); +- + librc_hidden_proto(rc_config_list) + librc_hidden_proto(rc_config_load) + librc_hidden_proto(rc_config_value) +diff -ru a/src/librc/rc.h.in b/src/librc/rc.h.in +--- a/src/librc/rc.h.in 2009-09-01 11:42:31.000000000 +0000 ++++ b/src/librc/rc.h.in 2009-09-01 11:42:47.000000000 +0000 +@@ -517,5 +517,9 @@ + * @return NULL terminated list of pids */ + RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t); + ++/* getline is a handy glibc function that not all libcs have, so ++ * we have our own */ ++ssize_t rc_getline(char **, size_t *, FILE *); ++ + __END_DECLS + #endif +diff -ru a/src/librc/rc.map b/src/librc/rc.map +--- a/src/librc/rc.map 2009-09-01 11:42:31.000000000 +0000 ++++ b/src/librc/rc.map 2009-09-01 11:42:47.000000000 +0000 +@@ -12,6 +12,7 @@ + rc_deptree_update_needed; + rc_environ_fd; + rc_find_pids; ++ rc_getline; + rc_newer_than; + rc_older_than; + rc_runlevel_exists; +diff -ru a/src/rc/rc.c b/src/rc/rc.c +--- a/src/rc/rc.c 2009-09-01 11:42:31.000000000 +0000 ++++ b/src/rc/rc.c 2009-09-01 11:47:00.000000000 +0000 +@@ -43,10 +43,6 @@ + #include + #include + +-#ifdef __linux__ +-# include /* for COMMAND_LINE_SIZE */ +-#endif +- + #include + #include + #include +@@ -177,10 +173,8 @@ + proc_getent(const char *ent) + { + FILE *fp; +- char proc[COMMAND_LINE_SIZE]; +- char *p; +- char *value = NULL; +- int i; ++ char *proc, *p, *value = NULL; ++ size_t i; + + if (!exists("/proc/cmdline")) + return NULL; +@@ -190,11 +184,11 @@ + return NULL; + } + +- memset(proc, 0, sizeof(proc)); +- p = fgets(proc, sizeof(proc), fp); +- if (p == NULL) +- eerror("fgets: %s", strerror(errno)); +- else if (*proc && (p = strstr(proc, ent))) { ++ proc = NULL; ++ i = 0; ++ if (rc_getline(&proc, &i, fp) == -1 || proc == NULL) ++ eerror("rc_getline: %s", strerror(errno)); ++ if (*proc && (p = strstr(proc, ent))) { + i = p - proc; + if (i == '\0' || proc[i - 1] == ' ') { + p += strlen(ent); +@@ -205,6 +199,7 @@ + } else + errno = ENOENT; + fclose(fp); ++ free(proc); + + return value; + } +diff -ru a/src/test/rc.funcs.list b/src/test/rc.funcs.list +--- a/src/test/rc.funcs.list 2009-09-01 11:42:31.000000000 +0000 ++++ b/src/test/rc.funcs.list 2009-09-01 11:42:57.000000000 +0000 +@@ -20,6 +20,8 @@ + rc_deptree_update_needed@@RC_1.0 + rc_find_pids + rc_find_pids@@RC_1.0 ++rc_getline ++rc_getline@@RC_1.0 + rc_newer_than + rc_newer_than@@RC_1.0 + rc_older_than diff --git a/main/openrc/openrc-0.4.3-command-line-size-fix.patch b/main/openrc/openrc-0.4.3-command-line-size-fix.patch new file mode 100644 index 0000000000..0ca4c8b1de --- /dev/null +++ b/main/openrc/openrc-0.4.3-command-line-size-fix.patch @@ -0,0 +1,94 @@ +Index: src/librc/librc.h +=================================================================== +--- a/src/librc/librc.h (revision 7c81f74b60b9d15ed472f1ca63cab0a105a84c08) ++++ b/src/librc/librc.h (revision 6abeec74301d8406ebbbd653b9fe9a0e234c09bf) +@@ -73,6 +73,4 @@ + #define librc_hidden_def(x) hidden_def(x) + +-ssize_t rc_getline(char **, size_t *, FILE *); +- + librc_hidden_proto(rc_config_list) + librc_hidden_proto(rc_config_load) +Index: src/librc/rc.h.in +=================================================================== +--- a/src/librc/rc.h.in (revision c0fd1b49e49cec28c1f5a3a76f9db11c62e550dc) ++++ b/src/librc/rc.h.in (revision 6abeec74301d8406ebbbd653b9fe9a0e234c09bf) +@@ -518,4 +518,8 @@ + RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t); + ++/* getline is a handy glibc function that not all libcs have, so ++ * we have our own */ ++ssize_t rc_getline(char **, size_t *, FILE *); ++ + __END_DECLS + #endif +Index: src/librc/rc.map +=================================================================== +--- a/src/librc/rc.map (revision 6615eb4b689d7aa1d047bd9ed75eca80beac9767) ++++ b/src/librc/rc.map (revision 6abeec74301d8406ebbbd653b9fe9a0e234c09bf) +@@ -13,4 +13,5 @@ + rc_environ_fd; + rc_find_pids; ++ rc_getline; + rc_newer_than; + rc_older_than; +Index: src/rc/rc.c +=================================================================== +--- a/src/rc/rc.c ++++ b/src/rc/rc.c +@@ -43,10 +43,6 @@ + #include + #include + +-#ifdef __linux__ +-# include /* for COMMAND_LINE_SIZE */ +-#endif +- + #include + #include + #include +@@ -176,10 +172,8 @@ + proc_getent(const char *ent) + { + FILE *fp; +- char proc[COMMAND_LINE_SIZE]; +- char *p; +- char *value = NULL; +- int i; ++ char *proc, *p, *value = NULL; ++ size_t i; + + if (!exists("/proc/cmdline")) + return NULL; +@@ -189,8 +183,10 @@ + return NULL; + } + +- memset(proc, 0, sizeof(proc)); +- fgets(proc, sizeof(proc), fp); ++ proc = NULL; ++ i = 0; ++ if (rc_getline(&proc, &i, fp) == -1 || proc == NULL) ++ eerror("rc_getline: %s", strerror(errno)); + if (*proc && (p = strstr(proc, ent))) { + i = p - proc; + if (i == '\0' || proc[i - 1] == ' ') { +@@ -202,6 +198,7 @@ + } else + errno = ENOENT; + fclose(fp); ++ free(proc); + + return value; + } +Index: src/test/rc.funcs.list +=================================================================== +--- a/src/test/rc.funcs.list (revision 6615eb4b689d7aa1d047bd9ed75eca80beac9767) ++++ b/src/test/rc.funcs.list (revision 6abeec74301d8406ebbbd653b9fe9a0e234c09bf) +@@ -21,4 +21,6 @@ + rc_find_pids + rc_find_pids@@RC_1.0 ++rc_getline ++rc_getline@@RC_1.0 + rc_newer_than + rc_newer_than@@RC_1.0 -- cgit v1.2.3