aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-25 10:23:26 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-25 10:23:26 +0800
commit07f873d107539a4357c69e1f3ce8cef17cc6277f (patch)
treed45a8c78f766cbf861b8bf7b34d80dc76b75da7c /calendar/gui/gnome-cal.c
parentce6e9cd00e965c92debe331b7c762b18674bbc85 (diff)
downloadgsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.gz
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.bz2
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.lz
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.xz
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.tar.zst
gsoc2013-evolution-07f873d107539a4357c69e1f3ce8cef17cc6277f.zip
Fixed alarm saving code. Fixed alarm loading code. New -partial-
Fixed alarm saving code. Fixed alarm loading code. New -partial- implementation of the mail alarm. It is not working, I do not know what is closing stdin to sendmail svn path=/trunk/; revision=194
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 755785836a..534db8bb4c 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
+#include <fcntl.h>
#include "calendar.h"
#include "gnome-cal.h"
#include "gncal-day-panel.h"
@@ -257,9 +258,9 @@ execute (char *command, int close_standard)
*/
execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0);
- exit (127);
+ _exit (127);
} else {
- exit (127);
+ _exit (127);
}
}
wait (&status);
@@ -285,13 +286,31 @@ calendar_notify (time_t time, void *data)
if (ico->malarm.enabled && ico->malarm.trigger == time){
char *command;
time_t app = ico->malarm.trigger + ico->malarm.offset;
+ pid_t pid;
+ int p [2];
- command = g_copy_strings ("mail -s '",
- _("Reminder of your appointment at "),
- ctime (&app), "' '",
- ico->malarm.data, "' ",
- NULL);
- execute (command, 1);
+ pipe (p);
+ pid = fork ();
+ if (pid == 0){
+ const int top = max_open_files ();
+ int dev_null, i;
+
+ for (i = 0; i < top; i++)
+ if (i != p [1])
+ close (i);
+ dev_null = open ("/dev/null", O_RDWR);
+ dup2 (p [1], 0);
+ dup2 (dev_null, 1);
+ dup2 (dev_null, 2);
+ execl ("/usr/lib/sendmail", "/usr/lib/sendmail",
+ ico->malarm.data, NULL);
+ _exit (127);
+ }
+ close (p [1]);
+ command = g_copy_strings ("To: ", ico->malarm.data, "\n",
+ "Subject: ", _("Reminder of your appointment at "),
+ ctime (&app), "\n\n", NULL);
+ write (p [0], command, strlen (command));
g_free (command);
return;