aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/main.c')
-rw-r--r--calendar/gui/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 6c4a4b4522..1cd65f331e 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
+#include <errno.h>
#include "calendar.h"
#include "alarm.h"
#include "eventedit.h"
@@ -422,7 +423,12 @@ save_calendar_cmd (GtkWidget *widget, void *data)
if (gcal->cal->filename){
struct stat s;
- stat (gcal->cal->filename, &s);
+ if (stat (gcal->cal->filename, &s) == -1){
+ if (errno == ENOENT)
+ calendar_save (gcal->cal, gcal->cal->filename);
+
+ return;
+ }
if (s.st_mtime != gcal->cal->file_time){
GtkWidget *box;