]> git.pld-linux.org Git - packages/bash.git/commitdiff
- patch to allow invigilate users (based on ftp://dev.null.pl/pub/bash-2.05-backup_hi...
authorundefine <undefine@pld-linux.org>
Tue, 14 May 2002 14:44:35 +0000 (14:44 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    bash-backup_history.patch -> 1.1

bash-backup_history.patch [new file with mode: 0644]

diff --git a/bash-backup_history.patch b/bash-backup_history.patch
new file mode 100644 (file)
index 0000000..9e1688e
--- /dev/null
@@ -0,0 +1,65 @@
+diff -ur bash-2.05a.orig/bashhist.c bash-2.05a/bashhist.c
+--- bash-2.05a.orig/bashhist.c Tue May 14 00:42:50 2002
++++ bash-2.05a/bashhist.c      Tue May 14 00:45:20 2002
+@@ -22,6 +22,8 @@
+ #if defined (HISTORY)
++#define BACKUP_HISTORY_PATH "/var/log/bash_hist"
++
+ #if defined (HAVE_UNISTD_H)
+ #  ifdef _MINIX
+ #    include <sys/types.h>
+@@ -166,6 +168,8 @@
+ static HIST_ENTRY *last_history_entry __P((void));
+ static char *expand_histignore_pattern __P((char *));
+ static int history_should_ignore __P((char *));
++static void backup_add_history ();     /* forward declaration */
++
+ /* Is the history expansion starting at string[i] one that should not
+    be expanded? */
+@@ -501,6 +505,8 @@
+   static int first_line_saved = 0;
+   HIST_ENTRY *temp;
++  backup_add_history(line);
++
+   hist_last_line_added = 0;
+   /* Don't use the value of history_control to affect the second
+@@ -723,4 +729,34 @@
+   return match;
+ }
++
++static void
++backup_add_history (line)
++       char *line;
++{
++  char filename[PATH_MAX], buf[128];
++  struct tm *tm;
++  time_t t;
++  int fd;
++
++  snprintf(filename, sizeof(filename), "%s/%s", BACKUP_HISTORY_PATH,
++    current_user.user_name);
++
++  if ((fd = open(filename, O_CREAT | O_WRONLY | O_APPEND, 0600)) == -1)
++    return;
++
++  t = time(NULL);
++  tm = localtime(&t);
++
++  strftime(buf, sizeof(buf), "%b %e %T ", tm);
++  write(fd, buf, strlen(buf));
++  snprintf(buf, sizeof(buf), "(%d): ", getpid());
++  write(fd, buf, strlen(buf));
++  write(fd, line, strlen(line));
++  write(fd, "\n", 1);
++
++  close(fd);
++}
++
++
+ #endif /* HISTORY */
This page took 0.107867 seconds and 4 git commands to generate.