]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/gfilenotify.c (Fgfile_add_watch):
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 21 Aug 2015 09:40:38 +0000 (11:40 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 21 Aug 2015 09:40:38 +0000 (11:40 +0200)
Handle errors from g_file_monitor.

src/gfilenotify.c

index 5488fa3850764024cd6e734fc9b00969a746e142..5c6ebe65d870971c67338548dc8fbf9fb7f79f1d 100644 (file)
@@ -150,6 +150,7 @@ will be reported only in case of the `moved' event.  */)
   GFile *gfile;
   GFileMonitor *monitor;
   GFileMonitorFlags gflags = G_FILE_MONITOR_NONE;
+  GError *gerror = NULL;
 
   /* Check parameters.  */
   CHECK_STRING (file);
@@ -172,7 +173,14 @@ will be reported only in case of the `moved' event.  */)
     gflags |= G_FILE_MONITOR_SEND_MOVED;
 
   /* Enable watch.  */
-  monitor = g_file_monitor (gfile, gflags, NULL, NULL);
+  monitor = g_file_monitor (gfile, gflags, NULL, &gerror);
+  if (gerror)
+    {
+      char msg[1024];
+      strcpy (msg, gerror->message);
+      g_error_free (gerror);
+      xsignal1 (Qfile_notify_error, build_string (msg));
+    }
   if (! monitor)
     xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file);