8ca63119e0
- rhbz 133077: logrotate fixed to continue accounting during rotate - rhbz 141802: lastcomm was not handling all forms of --strict-match - rhbz 141971: rpm -e no longer leaves /var/lock/subsys/psacct - rhbz 43294: sa will never report any io because the kernel doesn't provide it. Tweaked configure.in to ignore ac_io in acct.h
69 lines
1.5 KiB
Diff
69 lines
1.5 KiB
Diff
--- acct-6.3.2/lastcomm.c.strictmatch 2005-02-01 17:01:54.000000000 -0500
|
||
+++ acct-6.3.2/lastcomm.c 2005-02-02 00:06:41.000000000 -0500
|
||
@@ -43,7 +43,9 @@
|
||
#ifdef HAVE_UNISTD_H
|
||
#include <unistd.h>
|
||
#endif
|
||
-
|
||
+#ifdef HAVE_STDLIB_H
|
||
+#include <stdlib.h>
|
||
+#endif
|
||
#include <pwd.h>
|
||
|
||
#include "common.h"
|
||
@@ -80,7 +82,7 @@
|
||
|
||
/* protos */
|
||
|
||
-void main PARAMS((int, char *[]));
|
||
+int main PARAMS((int, char *[]));
|
||
void give_usage PARAMS((void));
|
||
void parse_entries PARAMS((void));
|
||
char *devname PARAMS((long));
|
||
@@ -90,7 +92,7 @@
|
||
|
||
/* code */
|
||
|
||
-void
|
||
+int
|
||
main (int argc, char *argv[])
|
||
{
|
||
int c;
|
||
@@ -349,12 +351,30 @@
|
||
{
|
||
/* All categories must have one match. */
|
||
|
||
- if (all_list
|
||
- && hashtab_find (all_list, uid, 0) == NULL
|
||
- && hashtab_find (all_list, dev, 0) == NULL
|
||
- && hashtab_find (all_list, comm, COMM_LEN) == NULL)
|
||
- return 0;
|
||
-
|
||
+ if (all_list)
|
||
+ {
|
||
+ struct hashtab_order ho;
|
||
+ struct hashtab_elem* he;
|
||
+ char *key;
|
||
+ int haveall = 1;
|
||
+
|
||
+ /* walk the all_list hash */
|
||
+ he = hashtab_first( all_list, &ho );
|
||
+ if( he == NULL ) return 0; /* empty hash??? */
|
||
+ while (haveall && he)
|
||
+ {
|
||
+ key = (char *) hashtab_get_key(he);
|
||
+ /* every element must match at least one of {uid,dev,comm}
|
||
+ * our parameters
|
||
+ */
|
||
+ haveall &= !strcmp( key, uid ) || !strcmp( key, dev )
|
||
+ || !strncmp( key, comm, COMM_LEN );
|
||
+
|
||
+ he = hashtab_next( &ho );
|
||
+ }
|
||
+ return haveall;
|
||
+ }
|
||
+
|
||
if (tty_list && hashtab_find (tty_list, dev, 0) == NULL)
|
||
return 0;
|
||
|