Fix patch to fix FTBFS with gcc 4.8

This commit is contained in:
Peter Robinson 2013-02-11 19:39:04 +00:00
parent 5ff8c5d66b
commit ecd5f487e8
2 changed files with 125 additions and 121 deletions

View File

@ -1,119 +1,119 @@
diff -ur -x configure at-3.1.13.orig/atd.c at-3.1.13/atd.c diff -ur -x configure at-3.1.13.orig/atd.c at-3.1.13/atd.c
--- at-3.1.13.orig/atd.c 2011-11-16 11:30:22.424764253 -0500 --- at-3.1.13.orig/atd.c 2011-11-16 11:30:22.424764253 -0500
+++ at-3.1.13/atd.c 2011-11-16 16:41:12.102831656 -0500 +++ at-3.1.13/atd.c 2011-11-16 16:41:12.102831656 -0500
@@ -815,6 +815,54 @@ @@ -815,6 +815,54 @@
return next_job; return next_job;
} }
+#ifdef HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME
+timer_t timer; +timer_t timer;
+struct itimerspec timeout; +struct itimerspec timeout;
+ +
+void timer_setup() +void timer_setup()
+{ +{
+ struct sigevent sev; + struct sigevent sev;
+ +
+ sev.sigev_notify = SIGEV_SIGNAL; + sev.sigev_notify = SIGEV_SIGNAL;
+ sev.sigev_signo = SIGHUP; + sev.sigev_signo = SIGHUP;
+ sev.sigev_value.sival_ptr = &timer; + sev.sigev_value.sival_ptr = &timer;
+ +
+ memset(&timeout, 0, sizeof(timeout)); + memset(&timeout, 0, sizeof(timeout));
+ +
+ if (timer_create(CLOCK_REALTIME, &sev, &timer) < 0) + if (timer_create(CLOCK_REALTIME, &sev, &timer) < 0)
+ pabort("unable to create timer"); + pabort("unable to create timer");
+} +}
+ +
+time_t atd_gettime() +time_t atd_gettime()
+{ +{
+ struct timespec curtime; + struct timespec curtime;
+ +
+ clock_gettime(CLOCK_REALTIME, &curtime); + clock_gettime(CLOCK_REALTIME, &curtime);
+ +
+ return curtime.tv_sec; + return curtime.tv_sec;
+} +}
+ +
+void atd_setalarm(time_t next) +void atd_setalarm(time_t next)
+{ +{
+ timeout.it_value.tv_sec = next; + timeout.it_value.tv_sec = next;
+ timer_settime(timer, TIMER_ABSTIME, &timeout, NULL); + timer_settime(timer, TIMER_ABSTIME, &timeout, NULL);
+ pause(); + pause();
+} +}
+#else +#else
+void timer_setup() +void timer_setup()
+{ +{
+} +}
+ +
+time_t atd_gettime() +time_t atd_gettime()
+{ +{
+ return time(NULL); + return time(NULL);
+} +}
+ +
+void atd_setalarm(time_t next) +void atd_setalarm(time_t next)
+{ +{
+ sleep(next - atd_gettime()); + sleep(next - atd_gettime());
+} +}
+#endif +#endif
/* Global functions */ /* Global functions */
int int
@@ -835,7 +883,6 @@ @@ -835,7 +883,6 @@
struct sigaction act; struct sigaction act;
struct passwd *pwe; struct passwd *pwe;
struct group *ge; struct group *ge;
- -
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
selinux_enabled=is_selinux_enabled(); selinux_enabled=is_selinux_enabled();
#endif #endif
@@ -912,7 +959,7 @@ @@ -912,7 +959,7 @@
sigaction(SIGCHLD, &act, NULL); sigaction(SIGCHLD, &act, NULL);
if (!run_as_daemon) { if (!run_as_daemon) {
- now = time(NULL); - now = time(NULL);
+ now = atd_gettime(); + now = atd_gettime();
run_loop(); run_loop();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
@@ -935,13 +982,15 @@ @@ -935,13 +982,15 @@
act.sa_handler = set_term; act.sa_handler = set_term;
sigaction(SIGINT, &act, NULL); sigaction(SIGINT, &act, NULL);
+ timer_setup(); + timer_setup();
+ +
daemon_setup(); daemon_setup();
do { do {
- now = time(NULL); - now = time(NULL);
+ now = atd_gettime(); + now = atd_gettime();
next_invocation = run_loop(); next_invocation = run_loop();
if (next_invocation > now) { if (next_invocation > now) {
- sleep(next_invocation - now); - sleep(next_invocation - now);
+ atd_setalarm(next_invocation); + atd_setalarm(next_invocation);
} }
} while (!term_signal); } while (!term_signal);
daemon_cleanup(); daemon_cleanup();
diff -ur -x configure at-3.1.13.orig/config.h.in at-3.1.13/config.h.in diff -ur -x configure at-3.1.13.orig/config.h.in at-3.1.13/config.h.in
--- at-3.1.13.orig/config.h.in 2011-11-16 11:30:22.424764253 -0500 --- at-3.1.13.orig/config.h.in 2011-11-16 11:30:22.424764253 -0500
+++ at-3.1.13/config.h.in 2011-11-16 16:32:44.485426754 -0500 +++ at-3.1.13/config.h.in 2011-11-16 16:32:44.485426754 -0500
@@ -38,6 +38,9 @@ @@ -38,6 +38,9 @@
/* Define to 1 if you have the `getloadavg' function. */ /* Define to 1 if you have the `getloadavg' function. */
#undef HAVE_GETLOADAVG #undef HAVE_GETLOADAVG
+/* Define to 1 if you have the `clock_gettime' function. */ +/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME +#undef HAVE_TIMER_CREATE
+ +
/* Define to 1 if you have the <getopt.h> header file. */ /* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H #undef HAVE_GETOPT_H
diff -ur -x configure at-3.1.13.orig/configure.ac at-3.1.13/configure.ac diff -ur -x configure at-3.1.13.orig/configure.ac at-3.1.13/configure.ac
--- at-3.1.13.orig/configure.ac 2011-11-16 11:30:22.425764254 -0500 --- at-3.1.13.orig/configure.ac 2011-11-16 11:30:22.425764254 -0500
+++ at-3.1.13/configure.ac 2011-11-16 16:31:29.791561747 -0500 +++ at-3.1.13/configure.ac 2011-11-16 16:31:29.791561747 -0500
@@ -274,5 +274,9 @@ @@ -274,5 +274,9 @@
AC_SUBST(SELINUXLIB) AC_SUBST(SELINUXLIB)
AC_SUBST(WITH_SELINUX) AC_SUBST(WITH_SELINUX)
+dnl check for POSIX timer functions +dnl check for POSIX timer functions
+AC_SEARCH_LIBS([clock_gettime],[rt]) +AC_SEARCH_LIBS([timer_create],[rt])
+AC_CHECK_FUNCS([clock_gettime]) +AC_CHECK_FUNCS([timer_create])
+ +
AC_CONFIG_FILES(Makefile atrun atd.8 atrun.8 at.1 at.allow.5 batch) AC_CONFIG_FILES(Makefile atrun atd.8 atrun.8 at.1 at.allow.5 batch)
AC_OUTPUT AC_OUTPUT

View File

@ -3,12 +3,13 @@
Summary: Job spooling tools Summary: Job spooling tools
Name: at Name: at
Version: 3.1.13 Version: 3.1.13
Release: 11%{dist} Release: 12%{dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright # http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain # + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://ftp.debian.org/debian/pool/main/a/at URL: http://ftp.debian.org/debian/pool/main/a/at
Source: http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz Source: http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz
# git upstream source git://git.debian.org/git/collab-maint/at.git # git upstream source git://git.debian.org/git/collab-maint/at.git
Source1: pam_atd Source1: pam_atd
@ -95,7 +96,7 @@ rm -f lex.yy.* y.tab.*
--with-pam --with-pam
%endif %endif
make make %{?_smp_mflags} V=1
%install %install
make install \ make install \
@ -186,6 +187,9 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ
%attr(0755,root,root) %{_initrddir}/atd %attr(0755,root,root) %{_initrddir}/atd
%changelog %changelog
* Mon Feb 11 2013 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.13-12
- Fix patch to fix FTBFS with gcc 4.8
* Wed Nov 14 2012 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-11 * Wed Nov 14 2012 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.13-11
- fix license field again - fix license field again