Hello community,
here is the log from the commit of package acpid
checked in at Thu Jul 5 00:32:30 CEST 2007.
--------
--- acpid/acpid.changes 2007-06-19 13:50:02.000000000 +0200
+++ /mounts/work_src_done/STABLE/acpid/acpid.changes 2007-07-03 20:04:47.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Jul 3 20:03:59 CEST 2007 - seife@suse.de
+
+- update to version 1.0.6
+ mostly our patches included upstream
+- adjust init script to the new pcc-acpi module
+
+-------------------------------------------------------------------
Old:
----
acpid-1.0.4-close-fd-on-client-disconnect.diff
acpid-1.0.4.dif
acpid-1.0.4-signedness.diff
acpid-1.0.4-skip-editor-backup-files.diff
acpid-1.0.4.tar.gz
acpid-1.0.4-use-syslog.diff
New:
----
acpid-1.0.6.dif
acpid-1.0.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ acpid.spec ++++++
--- /var/tmp/diff_new_pack.F21975/_old 2007-07-05 00:32:02.000000000 +0200
+++ /var/tmp/diff_new_pack.F21975/_new 2007-07-05 00:32:02.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package acpid (Version 1.0.4)
+# spec file for package acpid (Version 1.0.6)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,10 +12,10 @@
Name: acpid
URL: http://acpid.sourceforge.net/
-Version: 1.0.4
-Release: 81
+Version: 1.0.6
+Release: 1
%define acpi_version 0.09
-License: GNU General Public License (GPL)
+License: GPL v2 or later
Group: System/Daemons
Autoreqprov: on
PreReq: %insserv_prereq %fillup_prereq
@@ -28,10 +28,6 @@
Source4: ibm_acpi.modprobe
Source5: events.default
Patch1: acpi_%{acpi_version}.dif
-Patch2: acpid-1.0.4-signedness.diff
-Patch3: acpid-1.0.4-close-fd-on-client-disconnect.diff
-Patch4: acpid-1.0.4-use-syslog.diff
-Patch5: acpid-1.0.4-skip-editor-backup-files.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64 ia64
@@ -57,10 +53,6 @@
%patch1
pushd acpi-%{acpi_version}
popd
-%patch2
-%patch3
-%patch4 -p1
-%patch5
cp %{S:2} %{S:3} %{S:4} %{S:5} .
%build
@@ -83,6 +75,8 @@
make prefix=%{buildroot}/usr install
install -Dm 644 acpi.1 %{buildroot}/%{_mandir}/man1/acpi.1
popd
+# for the rpmlint fascists
+mv samples examples
mkdir -p %{buildroot}/var/lib/acpi
# keep the logfile
install -dm 755 %buildroot%_var/log
@@ -113,7 +107,7 @@
/usr/sbin/rcacpid
/sbin/acpid
/usr/bin/acpi_listen
-%doc README.SuSE README Changelog samples
+%doc README.SuSE README Changelog examples
/usr/share/man/man8/acpid.8.gz
/usr/share/man/man8/acpi_listen.8.gz
/usr/bin/acpi
@@ -122,6 +116,10 @@
%dir %attr(0750, root, root) /var/lib/acpi
%changelog
+* Tue Jul 03 2007 - seife@suse.de
+- update to version 1.0.6
+ mostly our patches included upstream
+- adjust init script to the new pcc-acpi module
* Tue Jun 19 2007 - thoenig@suse.de
- Add $local_fs to Required-Start (b.n.c #285472)
* Mon Jun 04 2007 - lrupp@suse.de
++++++ acpid-1.0.4.dif -> acpid-1.0.6.dif ++++++
--- acpid/acpid-1.0.4.dif 2007-06-19 13:50:02.000000000 +0200
+++ /mounts/work_src_done/STABLE/acpid/acpid-1.0.6.dif 2007-07-03 20:07:25.000000000 +0200
@@ -1,14 +1,5 @@
--- acpid.c.orig 2004-10-18 00:33:51.000000000 +0200
+++ acpid.c 2005-08-02 19:22:04.000000000 +0200
-@@ -61,7 +61,7 @@
- main(int argc, char **argv)
- {
- int event_fd;
-- int sock_fd;
-+ int sock_fd = 0;
-
- /* learn who we really are */
- progname = (const char *)strrchr(argv[0], '/');
@@ -386,7 +386,8 @@
umask(0);
@@ -30,11 +21,3 @@
DEFS = -DVERSION="\"$(VERSION)\""
all: $(PROGS)
-@@ -36,6 +36,7 @@
- install: $(PROGS) man
- mkdir -p $(SBINDIR)
- install -m 750 acpid $(SBINDIR)
-+ mkdir -p $(BINDIR)
- install -m 755 acpi_listen $(BINDIR)
- mkdir -p $(MAN8DIR)
- install -m 644 $(MAN8GZ) $(MAN8DIR)
++++++ acpid-1.0.4.tar.gz -> acpid-1.0.6.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/acpid.8 new/acpid-1.0.6/acpid.8
--- old/acpid-1.0.4/acpid.8 2003-11-17 22:24:58.000000000 +0100
+++ new/acpid-1.0.6/acpid.8 2007-05-25 06:35:31.000000000 +0200
@@ -1,5 +1,6 @@
-.TH acpid 8 "August 2001"
-.\" Copyright (c) 2001 Sun Microsystems (thockin@sun.com)
+.TH acpid 8 ""
+.\" Portions Copyright (c) 2001 Sun Microsystems
+.\" Portions Copyright (c) Tim Hockin (thockin@hockin.org.com)
.SH NAME
acpid \- Advanced Configuration and Power Interface event daemon
.SH SYNOPSIS
@@ -47,7 +48,7 @@
.PP
.B acpid
will log all of it's activities, as well as the stdout and stderr of any
-actions to a log file (\fI/var/log/acpid\fP by default).
+actions to syslog.
.PP
All the default file and directories can be changed with commandline options.
.SH OPTIONS
@@ -59,20 +60,20 @@
.BI \-d "\fR, \fP" \--debug
This option increases the \fBacpid\fP debug level by one. If the debug level
is non-zero, \fBacpid\fP will run in the foreground, and will log to
-stdout/stderr, rather than a log file.
+stderr, in addition to the regular syslog.
.TP
.BI \-e "\fR, \fP" \--eventfile " filename"
This option changes the event file from which \fBacpid\fP reads events.
Default is \fI/proc/acpi/event\fP.
.TP
+.BI \-f "\fR, \fP" \--foreground
+This option keeps \fBacpid\fP in the foreground by not forking at startup.
+.TP
+.TP
.BI \-g "\fR, \fP" \--socketgroup " groupname"
This option changes the group ownership of the UNIX domain socket to which
\fBacpid\fP publishes events.
.TP
-.BI \-l "\fR, \fP" \--logfile " filename"
-This option changes the log file to which \fBacpid\fP writes. Default is
-\fI/var/log/acpid\fP.
-.TP
.BI \-m "\fR, \fP" \--socketmode " mode"
This option changes the permissions of the UNIX domain socket to which
\fBacpid\fP publishes events. Default is \fI0666\fP.
@@ -102,18 +103,13 @@
The script power.sh gets called and will see the complete event string
as parameter $1.
.SH DEPENDENCIES
-Please make sure you are using the latest ACPI code possible. This is
-available from
-.BR
- \fIhttp://developer.intel.com/technology/iapc/acpi/downloads.htm\fP.
+\fBacpid\fP should work on any linux kernel released since 2003.
.SH FILES
.PD 0
.B /proc/acpi/event
.br
.B /etc/acpi/
.br
-.B /var/log/acpid
-.br
.B /var/run/acpid.socket
.br
.PD
@@ -122,5 +118,5 @@
.SH SEE ALSO
regcomp(3), sh(1), socket(2), connect(2)
.SH AUTHORS
-Tim Hockin
+Tim Hockin
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/acpid.c new/acpid-1.0.6/acpid.c
--- old/acpid-1.0.4/acpid.c 2004-10-18 00:33:51.000000000 +0200
+++ new/acpid-1.0.6/acpid.c 2007-05-25 06:19:23.000000000 +0200
@@ -2,7 +2,8 @@
* acpid.c - ACPI daemon
*
* Portions Copyright (C) 2000 Andrew Henroid
- * Portions Copyright (C) 2001 Sun Microsystems (thockin@sun.com)
+ * Portions Copyright (C) 2001 Sun Microsystems
+ * Portions Copyright (C) 2004 Tim Hockin (thockin@hockin.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +33,7 @@
#include
#include
#include
+#include
#include "acpid.h"
#include "ud_socket.h"
@@ -39,7 +41,7 @@
static int handle_cmdline(int *argc, char ***argv);
static void close_fds(void);
static int daemonize(void);
-static int open_logs(void);
+static int open_log(void);
static void clean_exit(int sig);
static void reload_conf(int sig);
static char *read_line(int fd);
@@ -49,7 +51,6 @@
static const char *progname;
static const char *confdir = ACPI_CONFDIR;
-static const char *logfile = ACPI_LOGFILE;
static const char *eventfile = ACPI_EVENTFILE;
static const char *socketfile = ACPI_SOCKETFILE;
static int nosocket;
@@ -61,7 +62,7 @@
main(int argc, char **argv)
{
int event_fd;
- int sock_fd;
+ int sock_fd = -1; /* init to avoid a compiler warning */
/* learn who we really are */
progname = (const char *)strrchr(argv[0], '/');
@@ -153,12 +154,11 @@
exit(EXIT_FAILURE);
}
- /* normal logging unless debugging */
- if (!acpid_debug) {
- if (open_logs() < 0)
- exit(EXIT_FAILURE);
+ /* open the log */
+ if (open_log() < 0) {
+ exit(EXIT_FAILURE);
}
- acpid_log("starting up\n");
+ acpid_log(LOG_INFO, "starting up\n");
/* trap key signals */
signal(SIGHUP, reload_conf);
@@ -186,7 +186,7 @@
if (r < 0 && errno == EINTR) {
continue;
} else if (r < 0) {
- acpid_log("ERR: poll(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "poll(): %s\n", strerror(errno));
continue;
}
@@ -196,25 +196,30 @@
/* this shouldn't happen */
if (!ar[0].revents & POLLIN) {
- acpid_log("odd, poll set flags 0x%x\n",
- ar[0].revents);
+ acpid_log(LOG_DEBUG,
+ "odd, poll set flags 0x%x\n",
+ ar[0].revents);
continue;
}
/* read and handle an event */
event = read_line(event_fd);
if (event) {
- acpid_log("received event \"%s\"\n", event);
+ acpid_log(LOG_INFO,
+ "received event \"%s\"\n", event);
acpid_handle_event(event);
- acpid_log("completed event \"%s\"\n", event);
+ acpid_log(LOG_INFO,
+ "completed event \"%s\"\n", event);
} else if (errno == EPIPE) {
- acpid_log("events file connection closed\n");
+ acpid_log(LOG_WARNING,
+ "events file connection closed\n");
break;
} else {
static int nerrs;
if (++nerrs >= ACPI_MAX_ERRS) {
- acpid_log("too many errors reading "
- "events file - aborting\n");
+ acpid_log(LOG_ERR,
+ "too many errors reading "
+ "events file - aborting\n");
break;
}
}
@@ -228,16 +233,17 @@
/* this shouldn't happen */
if (!ar[1].revents & POLLIN) {
- acpid_log("odd, poll set flags 0x%x\n",
- ar[1].revents);
+ acpid_log(LOG_DEBUG,
+ "odd, poll set flags 0x%x\n",
+ ar[1].revents);
continue;
}
/* accept and add to our lists */
cli_fd = ud_accept(sock_fd, &creds);
if (cli_fd < 0) {
- acpid_log("ERR: can't accept client: %s\n",
- strerror(errno));
+ acpid_log(LOG_ERR, "can't accept client: %s\n",
+ strerror(errno));
continue;
}
snprintf(buf, sizeof(buf)-1, "%d[%d:%d]",
@@ -263,7 +269,6 @@
{"eventfile", 1, 0, 'e'},
{"foreground", 0, 0, 'f'},
{"socketgroup", 1, 0, 'g'},
- {"logfile", 1, 0, 'l'},
{"socketmode", 1, 0, 'm'},
{"socketfile", 1, 0, 's'},
{"nosocket", 1, 0, 'S'},
@@ -277,7 +282,6 @@
"Use the specified file for events.", /* eventfile */
"Run in the foreground.", /* foreground */
"Set the group on the socket file.", /* socketgroup */
- "Use the specified log file.", /* logfile */
"Set the permissions on the socket file.",/* socketmode */
"Use the specified socket file.", /* socketfile */
"Do not listen on a UNIX socket (overrides -s).",/* nosocket */
@@ -290,7 +294,7 @@
for (;;) {
int i;
- i = getopt_long(*argc, *argv, "c:de:fg:l:m:s:Svh", opts, NULL);
+ i = getopt_long(*argc, *argv, "c:de:fg:m:s:Svh", opts, NULL);
if (i == -1) {
break;
}
@@ -311,9 +315,6 @@
case 'g':
socketgroup = optarg;
break;
- case 'l':
- logfile = optarg;
- break;
case 'm':
socketmode = strtol(optarg, NULL, 8);
break;
@@ -392,40 +393,40 @@
}
static int
-open_logs(void)
+open_log(void)
{
- int logfd;
int nullfd;
+ int log_opts;
- /* set up stdout, stderr to log and stdin to /dev/null */
+ /* open /dev/null */
nullfd = open("/dev/null", O_RDONLY, 0640);
if (nullfd < 0) {
fprintf(stderr, "%s: can't open %s: %s\n", progname,
"/dev/null", strerror(errno));
return -1;
}
- logfd = open(logfile, O_WRONLY|O_CREAT|O_APPEND);
- if (logfd < 0) {
- fprintf(stderr, "%s: can't open %s: %s\n", progname,
- logfile, strerror(errno));
- return -1;
+
+ log_opts = LOG_CONS|LOG_NDELAY;
+ if (acpid_debug) {
+ log_opts |= LOG_PERROR;
}
+ openlog(PACKAGE, log_opts, LOG_DAEMON);
+ /* set up stdin, stdout, stderr to /dev/null */
if (dup2(nullfd, STDIN_FILENO) != STDIN_FILENO) {
fprintf(stderr, "%s: dup2: %s\n", progname, strerror(errno));
return -1;
}
- if (dup2(logfd, STDOUT_FILENO) != STDOUT_FILENO) {
+ if (!acpid_debug&& dup2(nullfd, STDOUT_FILENO) != STDOUT_FILENO) {
fprintf(stderr, "%s: dup2: %s\n", progname, strerror(errno));
return -1;
}
- if (dup2(logfd, STDERR_FILENO) != STDERR_FILENO) {
+ if (!acpid_debug && dup2(nullfd, STDERR_FILENO) != STDERR_FILENO) {
fprintf(stderr, "%s: dup2: %s\n", progname, strerror(errno));
return -1;
}
close(nullfd);
- close(logfd);
return 0;
}
@@ -433,33 +434,26 @@
static void
clean_exit(int sig)
{
- acpid_cleanup_rules();
- acpid_log("exiting\n");
+ acpid_cleanup_rules(1);
+ acpid_log(LOG_NOTICE, "exiting\n");
exit(EXIT_SUCCESS);
}
static void
reload_conf(int sig)
{
- acpid_log("reloading configuration\n");
- acpid_cleanup_rules();
+ acpid_log(LOG_NOTICE, "reloading configuration\n");
+ acpid_cleanup_rules(0);
acpid_read_conf(confdir);
}
int
-acpid_log(const char *fmt, ...)
+acpid_log(int level, const char *fmt, ...)
{
va_list args;
- int len = 0;
- time_t curtime;
- char *timestr;
va_start(args, fmt);
- curtime = time(NULL);
- timestr = ctime(&curtime);
- timestr[strlen(timestr)-1] = '\0';
- len += fprintf(stderr, "[%s] ", timestr);
- len += vfprintf(stderr, fmt, args);
+ vsyslog(level, fmt, args);
va_end(args);
return 0;
@@ -481,7 +475,7 @@
while (searching) {
buf = realloc(buf, buflen);
if (!buf) {
- acpid_log("ERR: malloc(%d): %s\n",
+ acpid_log(LOG_ERR, "malloc(%d): %s\n",
buflen, strerror(errno));
return NULL;
}
@@ -491,7 +485,7 @@
r = read(fd, buf+i, 1);
if (r < 0 && errno != EINTR) {
/* we should do something with the data */
- acpid_log("ERR: read(): %s\n",
+ acpid_log(LOG_ERR, "read(): %s\n",
strerror(errno));
return NULL;
} else if (r == 0) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/acpid.h new/acpid-1.0.6/acpid.h
--- old/acpid-1.0.4/acpid.h 2001-08-17 20:30:31.000000000 +0200
+++ new/acpid-1.0.6/acpid.h 2007-05-24 08:33:33.000000000 +0200
@@ -2,7 +2,8 @@
* acpid.h - ACPI daemon
*
* Copyright (C) 1999-2000 Andrew Henroid
- * Copyright (C) 2001 Sun Microsystems (thockin@sun.com)
+ * Copyright (C) 2001 Sun Microsystems
+ * Portions Copyright (C) 2004 Tim Hockin (thockin@hockin.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +32,6 @@
#define ACPI_PROCDIR "/proc/acpi"
#define ACPI_EVENTFILE ACPI_PROCDIR "/event"
#define ACPI_CONFDIR "/etc/acpi/events"
-#define ACPI_LOGFILE "/var/log/acpid"
#define ACPI_SOCKETFILE "/var/run/acpid.socket"
#define ACPI_SOCKETMODE 0666
#define ACPI_MAX_ERRS 5
@@ -42,14 +42,14 @@
* acpid.c
*/
extern int acpid_debug;
-extern int acpid_log(const char *fmt, ...);
+extern int acpid_log(int level, const char *fmt, ...);
/*
* event.c
*/
extern int acpid_read_conf(const char *confdir);
extern int acpid_add_client(int client, const char *origin);
-extern int acpid_cleanup_rules(void);
+extern int acpid_cleanup_rules(int do_detach);
extern int acpid_handle_event(const char *event);
#endif /* ACPID_H__ */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/acpi_listen.8 new/acpid-1.0.6/acpi_listen.8
--- old/acpid-1.0.4/acpi_listen.8 2004-02-03 03:38:52.000000000 +0100
+++ new/acpid-1.0.6/acpi_listen.8 2007-01-17 08:57:51.000000000 +0100
@@ -1,5 +1,6 @@
.TH acpi_listen 17 "Nov 2003"
-.\" Copyright (c) 2003 Sun Microsystems (thockin@sun.com)
+.\" Portions Copyright (c) 2003 Sun Microsystems
+.\" Copyright (c) 2004 Tim Hockin (thockin@hockin.org)
.\" Some parts (C) 2003 - Gismo / Luca Capello http://luca.pca.it
.SH NAME
acpi_listen \- ACPI event listener
@@ -39,7 +40,7 @@
.SH SEE ALSO
regcomp(3), sh(1), socket(2), connect(2)
.SH AUTHORS
-Tim Hockin
+Tim Hockin
.br
Luca Capello
.br
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/acpi_listen.c new/acpid-1.0.6/acpi_listen.c
--- old/acpid-1.0.4/acpi_listen.c 2004-10-18 00:25:08.000000000 +0200
+++ new/acpid-1.0.6/acpi_listen.c 2007-01-17 08:57:51.000000000 +0100
@@ -3,6 +3,7 @@
*
* Portions Copyright (C) 2003 Sun Microsystems (thockin@sun.com)
* Some parts (C) 2003 - Gismo / Luca Capello http://luca.pca.it
+ * Copyright (C) 2004 Tim Hockin (thockin@hockin.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/Changelog new/acpid-1.0.6/Changelog
--- old/acpid-1.0.4/Changelog 2004-10-18 00:53:40.000000000 +0200
+++ new/acpid-1.0.6/Changelog 2007-06-30 21:17:22.000000000 +0200
@@ -1,4 +1,39 @@
%changelog
+* Sat June 30 2007 Tim Hockin
+ - Bump version to 1.0.6 for release.
+
+* Thu May 24 2007 Tim Hockin
+ - Print event handler output to stdout only in debug mode (acpid.c, event.c).
+ - Update man page for new logging.
+
+* Wed May 23 2007 Tim Hockin
+ - Correctly check for malloc() failures (event.c)
+ - Skip editor backup files when scanning for conf files (event.c) (Stefan
+ Seyfried )
+ - Use syslog() for logging (acpid.c, event.c, acpid.h) (Stefan Seyfried
+ )
+
+* Fri Dec 30 2005 Tim Hockin
+ - Add a do_detach argument to acpid_cleanup_rules() to avoid closing
+ clients on a HUP (acpid.c, event.c) (Frederic Lepied
+ )
+
+* Sat Sep 24 2005 Tim Hockin
+ - Document -f option in the acpid man page (acpid.8)
+
+* Fri Sep 23 2005 Tim Hockin
+ - Fix rule and fd leak when clients disconnect on socket (event.c) (Timo
+ Hoenig )
+
+* Fri Oct 19 2005 Tim Hockin
+ - Use socklen_t for sockets calls (ud_socket.c)
+
+* Sun Oct 24 2004 Tim Hockin
+ - Update my own email to not say @sun.com anymore
+
+* Sun Oct 17 2004 Tim Hockin
+ - mkdir BINDIR in Makefile
+
* Sun Oct 17 2004 Tim Hockin
- set acpi_listen stdout to be line-buffered (Gilles Chanteperdrix
)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/event.c new/acpid-1.0.6/event.c
--- old/acpid-1.0.4/event.c 2004-02-03 03:38:52.000000000 +0100
+++ new/acpid-1.0.6/event.c 2007-05-25 06:26:09.000000000 +0200
@@ -3,6 +3,7 @@
*
* Copyright (C) 2000 Andrew Henroid
* Copyright (C) 2001 Sun Microsystems (thockin@sun.com)
+ * Copyright (C) 2004 Tim Hockin (thockin@hockin.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -86,7 +87,8 @@
struct stat s;
if (stat(path, &s)) {
- acpid_log("ERR: stat(\"%s\"): %s\n", path, strerror(errno));
+ acpid_log(LOG_ERR, "stat(\"%s\"): %s\n",
+ path, strerror(errno));
return 0;
}
return S_ISDIR(s.st_mode);
@@ -107,7 +109,7 @@
dir = opendir(confdir);
if (!dir) {
- acpid_log("ERR: opendir(%s): %s\n",
+ acpid_log(LOG_ERR, "opendir(%s): %s\n",
confdir, strerror(errno));
unlock_rules();
return -1;
@@ -121,10 +123,17 @@
if (dirent->d_name[0] == '.')
continue; /* skip dotfiles */
- len = strlen(dirent->d_name) + strlen(confdir) + 2;
+ len = strlen(dirent->d_name);
+
+ if (dirent->d_name[len - 1] == '~') {
+ continue; /* skip editor backup files */
+ }
+
+ len += strlen(confdir) + 2;
+
file = (char *)malloc(len);
if (!file) {
- acpid_log("ERR: malloc(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
unlock_rules();
return -1;
}
@@ -145,7 +154,8 @@
closedir(dir);
unlock_rules();
- acpid_log("%d rule%s loaded\n", nrules, (nrules == 1)?"":"s");
+ acpid_log(LOG_INFO, "%d rule%s loaded\n",
+ nrules, (nrules == 1)?"":"s");
return 0;
}
@@ -154,7 +164,7 @@
* cleanup all rules
*/
int
-acpid_cleanup_rules(void)
+acpid_cleanup_rules(int do_detach)
{
struct rule *p;
struct rule *next;
@@ -162,17 +172,19 @@
lock_rules();
if (acpid_debug >= 3) {
- acpid_log("DBG: cleaning up rules\n");
+ acpid_log(LOG_DEBUG, "cleaning up rules\n");
}
- /* tell our clients to buzz off */
- p = client_list.head;
- while (p) {
- next = p->next;
- delist_rule(&client_list, p);
- close(p->action.fd);
- free_rule(p);
- p = next;
+ if (do_detach) {
+ /* tell our clients to buzz off */
+ p = client_list.head;
+ while (p) {
+ next = p->next;
+ delist_rule(&client_list, p);
+ close(p->action.fd);
+ free_rule(p);
+ p = next;
+ }
}
/* clear out our conf rules */
@@ -198,12 +210,12 @@
struct rule *r;
if (acpid_debug) {
- acpid_log("DBG: parsing conf file %s\n", file);
+ acpid_log(LOG_DEBUG, "parsing conf file %s\n", file);
}
fp = fopen(file, "r");
if (!fp) {
- acpid_log("ERR: fopen(%s): %s\n", file, strerror(errno));
+ acpid_log(LOG_ERR, "fopen(%s): %s\n", file, strerror(errno));
return NULL;
}
@@ -216,7 +228,7 @@
r->type = RULE_CMD;
r->origin = strdup(file);
if (!r->origin) {
- acpid_log("ERR: strdup(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "strdup(): %s\n", strerror(errno));
free_rule(r);
fclose(fp);
return NULL;
@@ -249,19 +261,20 @@
/* quick parse */
n = sscanf(p, "%63[^=\n]=%255[^\n]", key, val);
if (n != 2) {
- acpid_log("can't parse %s at line %d\n",
- file, line);
+ acpid_log(LOG_WARNING, "can't parse %s at line %d\n",
+ file, line);
continue;
}
if (acpid_debug >= 3) {
- acpid_log("DBG: key=\"%s\" val=\"%s\"\n", key, val);
+ acpid_log(LOG_DEBUG, " key=\"%s\" val=\"%s\"\n",
+ key, val);
}
/* handle the parsed line */
if (!strcasecmp(key, "event")) {
int rv;
r->event = malloc(sizeof(regex_t));
- if (!r) {
- acpid_log("ERR: malloc(): %s\n",
+ if (!r->event) {
+ acpid_log(LOG_ERR, "malloc(): %s\n",
strerror(errno));
free_rule(r);
fclose(fp);
@@ -271,35 +284,38 @@
if (rv) {
char buf[128];
regerror(rv, r->event, buf, sizeof(buf));
- acpid_log("ERR: regcomp(): %s\n", buf);
+ acpid_log(LOG_ERR, "regcomp(): %s\n", buf);
free_rule(r);
fclose(fp);
return NULL;
}
} else if (!strcasecmp(key, "action")) {
if (check_escapes(val) < 0) {
- acpid_log("ERR: can't load file %s\n", file);
+ acpid_log(LOG_ERR, "can't load file %s\n",
+ file);
free_rule(r);
fclose(fp);
return NULL;
}
r->action.cmd = strdup(val);
if (!r->action.cmd) {
- acpid_log("ERR: strdup(): %s\n",
+ acpid_log(LOG_ERR, "strdup(): %s\n",
strerror(errno));
free_rule(r);
fclose(fp);
return NULL;
}
} else {
- acpid_log("unknown option '%s' in %s at line %d\n",
- key, file, line);
+ acpid_log(LOG_WARNING,
+ "unknown option '%s' in %s at line %d\n",
+ key, file, line);
continue;
}
}
if (!r->event || !r->action.cmd) {
if (acpid_debug) {
- acpid_log("DBG: skipping incomplete file %s\n", file);
+ acpid_log(LOG_DEBUG, "skipping incomplete file %s\n",
+ file);
}
free_rule(r);
return NULL;
@@ -315,7 +331,7 @@
struct rule *r;
int nrules = 0;
- acpid_log("client connected from %s\n", origin);
+ acpid_log(LOG_NOTICE, "client connected from %s\n", origin);
r = parse_client(clifd);
if (r) {
@@ -324,7 +340,8 @@
nrules++;
}
- acpid_log("%d client rule%s loaded\n", nrules, (nrules == 1)?"":"s");
+ acpid_log(LOG_INFO, "%d client rule%s loaded\n",
+ nrules, (nrules == 1)?"":"s");
return 0;
}
@@ -343,8 +360,8 @@
r->type = RULE_CLIENT;
r->action.fd = client;
r->event = malloc(sizeof(regex_t));
- if (!r) {
- acpid_log("ERR: malloc(): %s\n", strerror(errno));
+ if (!r->event) {
+ acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
free_rule(r);
return NULL;
}
@@ -352,7 +369,7 @@
if (rv) {
char buf[128];
regerror(rv, r->event, buf, sizeof(buf));
- acpid_log("ERR: regcomp(): %s\n", buf);
+ acpid_log(LOG_ERR, "regcomp(): %s\n", buf);
free_rule(r);
return NULL;
}
@@ -402,7 +419,7 @@
r = malloc(sizeof(*r));
if (!r) {
- acpid_log("ERR: malloc(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "malloc(): %s\n", strerror(errno));
return NULL;
}
@@ -460,8 +477,9 @@
if (!regexec(p->event, event, 0, NULL, 0)) {
/* a match! */
if (acpid_debug) {
- acpid_log("DBG: rule from %s matched\n",
- p->origin);
+ acpid_log(LOG_DEBUG,
+ "rule from %s matched\n",
+ p->origin);
}
nrules++;
if (p->type == RULE_CMD) {
@@ -469,13 +487,15 @@
} else if (p->type == RULE_CLIENT) {
do_client_rule(p, event);
} else {
- acpid_log("unknown rule type: %d\n",
- p->type);
+ acpid_log(LOG_WARNING,
+ "unknown rule type: %d\n",
+ p->type);
}
} else {
if (acpid_debug >= 3) {
- acpid_log("DBG: rule from %s did not "
- "match\n", p->origin);
+ acpid_log(LOG_DEBUG,
+ "rule from %s did not match\n",
+ p->origin);
}
}
p = pnext;
@@ -485,7 +505,7 @@
unlock_rules();
if (acpid_debug) {
- acpid_log("DBG: %d total rule%s matched\n",
+ acpid_log(LOG_DEBUG, "%d total rule%s matched\n",
nrules, (nrules == 1)?"":"s");
}
@@ -511,7 +531,7 @@
lock_rules(void)
{
if (acpid_debug >= 4) {
- acpid_log("DBG: blocking signals for rule lock\n");
+ acpid_log(LOG_DEBUG, "blocking signals for rule lock\n");
}
sigprocmask(SIG_BLOCK, signals_handled(), NULL);
}
@@ -520,7 +540,7 @@
unlock_rules(void)
{
if (acpid_debug >= 4) {
- acpid_log("DBG: unblocking signals for rule lock\n");
+ acpid_log(LOG_DEBUG, "unblocking signals for rule lock\n");
}
sigprocmask(SIG_UNBLOCK, signals_handled(), NULL);
}
@@ -539,12 +559,12 @@
pid = fork();
switch (pid) {
case -1:
- acpid_log("ERR: fork(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "fork(): %s\n", strerror(errno));
return -1;
case 0: /* child */
/* parse the commandline, doing any substitutions needed */
action = parse_cmd(rule->action.cmd, event);
- acpid_log("executing action \"%s\"\n", action);
+ acpid_log(LOG_INFO, "executing action \"%s\"\n", action);
/* reset signals */
signal(SIGHUP, SIG_DFL);
@@ -554,23 +574,27 @@
signal(SIGPIPE, SIG_DFL);
sigprocmask(SIG_UNBLOCK, signals_handled(), NULL);
- acpid_log("BEGIN HANDLER MESSAGES\n");
+ if (acpid_debug)
+ fprintf(stdout, "BEGIN HANDLER MESSAGES\n");
execl("/bin/sh", "/bin/sh", "-c", action, NULL);
/* should not get here */
- acpid_log("ERR: execl(): %s\n", strerror(errno));
+ acpid_log(LOG_ERR, "execl(): %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
/* parent */
waitpid(pid, &status, 0);
- acpid_log("END HANDLER MESSAGES\n");
+ if (acpid_debug)
+ fprintf(stdout, "END HANDLER MESSAGES\n");
if (WIFEXITED(status)) {
- acpid_log("action exited with status %d\n",
- WEXITSTATUS(status));
+ acpid_log(LOG_INFO, "action exited with status %d\n",
+ WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
- acpid_log("action exited on signal %d\n", WTERMSIG(status));
+ acpid_log(LOG_INFO, "action exited on signal %d\n",
+ WTERMSIG(status));
} else {
- acpid_log("action exited with status %d\n", status);
+ acpid_log(LOG_INFO, "action exited with status %d\n",
+ status);
}
return 0;
@@ -582,13 +606,15 @@
int r;
int client = rule->action.fd;
- acpid_log("notifying client %s\n", rule->origin);
+ acpid_log(LOG_INFO, "notifying client %s\n", rule->origin);
r = safe_write(client, event, strlen(event));
if (r < 0 && errno == EPIPE) {
/* closed */
- acpid_log("client has disconnected\n");
+ acpid_log(LOG_NOTICE, "client has disconnected\n");
delist_rule(&client_list, rule);
+ close(rule->action.fd);
+ free_rule(rule);
return -1;
}
safe_write(client, "\n", 1);
@@ -622,7 +648,7 @@
if (!ntries) {
/* crap */
if (acpid_debug >= 2) {
- acpid_log("uh-oh! safe_write() timed out\n");
+ acpid_log(LOG_ERR, "uh-oh! safe_write() timed out\n");
}
return r;
}
@@ -659,7 +685,7 @@
buf[i++] = *p++;
}
if (acpid_debug >= 2) {
- acpid_log("DBG: expanded \"%s\" -> \"%s\"\n", cmd, buf);
+ acpid_log(LOG_DEBUG, "expanded \"%s\" -> \"%s\"\n", cmd, buf);
}
return buf;
@@ -677,10 +703,12 @@
if (*p == '%') {
p++;
if (!*p) {
- acpid_log("invalid escape at EOL\n");
+ acpid_log(LOG_WARNING,
+ "invalid escape at EOL\n");
return -1;
} else if (*p != '%' && *p != 'e') {
- acpid_log("invalid escape \"%%%c\"\n", *p);
+ acpid_log(LOG_WARNING,
+ "invalid escape \"%%%c\"\n", *p);
r = -1;
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/Makefile new/acpid-1.0.6/Makefile
--- old/acpid-1.0.4/Makefile 2004-10-18 00:54:28.000000000 +0200
+++ new/acpid-1.0.6/Makefile 2007-06-30 21:15:45.000000000 +0200
@@ -1,7 +1,7 @@
# Makefile for ACPI daemon
# update these numbers for new releases
-VERSION = 1.0.4
+VERSION = 1.0.6
INSTPREFIX =
BINDIR = $(INSTPREFIX)/usr/bin
@@ -35,6 +35,7 @@
install: $(PROGS) man
mkdir -p $(SBINDIR)
+ mkdir -p $(BINDIR)
install -m 750 acpid $(SBINDIR)
install -m 755 acpi_listen $(BINDIR)
mkdir -p $(MAN8DIR)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/TODO new/acpid-1.0.6/TODO
--- old/acpid-1.0.4/TODO 2003-05-14 00:45:30.000000000 +0200
+++ new/acpid-1.0.6/TODO 2007-05-24 06:52:48.000000000 +0200
@@ -1,6 +1,7 @@
Future Enhancements
-------------------
+DBUS support
Re-implement autoconf/automake support
Re-add ancillary files needed for wider distribution
Add a main config file
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/acpid-1.0.4/ud_socket.c new/acpid-1.0.6/ud_socket.c
--- old/acpid-1.0.4/ud_socket.c 2003-11-17 22:24:58.000000000 +0100
+++ new/acpid-1.0.6/ud_socket.c 2007-01-17 08:57:51.000000000 +0100
@@ -1,5 +1,5 @@
/*
- * $Id: ud_socket.c,v 1.4 2003/11/17 21:24:58 sunthockin Exp $
+ * $Id: ud_socket.c,v 1.5 2005/08/19 06:56:21 thockin Exp $
* A few routines for handling UNIX domain sockets
*/
@@ -58,7 +58,7 @@
while (1) {
int newsock = 0;
struct sockaddr_un cliaddr;
- int len = sizeof(struct sockaddr_un);
+ socklen_t len = sizeof(struct sockaddr_un);
newsock = accept(listenfd, (struct sockaddr *)&cliaddr, &len);
if (newsock < 0) {
@@ -71,7 +71,7 @@
if (cred) {
len = sizeof(struct ucred);
- getsockopt(newsock, SOL_SOCKET, SO_PEERCRED,cred,&len);
+ getsockopt(newsock,SOL_SOCKET,SO_PEERCRED,cred,&len);
}
return newsock;
++++++ rcacpid ++++++
--- acpid/rcacpid 2007-06-19 13:50:02.000000000 +0200
+++ /mounts/work_src_done/STABLE/acpid/rcacpid 2007-07-03 20:03:48.000000000 +0200
@@ -147,7 +147,7 @@
continue
fi ;;
pcc_acpi)
- if [ ! -r /proc/acpi/panasonic ] ; then
+ if [ ! -r /proc/acpi/panasonic -a ! -r /proc/acpi/pcc ] ; then
grep -wq $m /proc/modules && rmmod pcc_acpi;
continue
fi ;;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org