diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-13 15:45:17 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-08-13 15:55:53 -0700 |
commit | 76101698a770d389f22b547c331ec78473040c47 (patch) | |
tree | 411115b04cec15dcc216e67818080221dbdaecf5 /src/gfilenotify.c | |
parent | eb787d749f28583906428269b926fa83aef092b9 (diff) | |
download | emacs-76101698a770d389f22b547c331ec78473040c47.tar.gz |
Fix check for unsafe watch descriptor
* src/lisp.h (make_pointer_integer_unsafe): New function.
(make_pointer_integer): Use it.
* src/gfilenotify.c (dir_monitor_callback): Omit redundant eassert.
(Fgfile_add_watch): Signal an error instead of failing an
assertion if the pointer does not work.
Diffstat (limited to 'src/gfilenotify.c')
-rw-r--r-- | src/gfilenotify.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 7eea2cfac1c..798f308b315 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c @@ -77,7 +77,6 @@ dir_monitor_callback (GFileMonitor *monitor, /* Determine callback function. */ monitor_object = make_pointer_integer (monitor); - eassert (FIXNUMP (monitor_object)); watch_object = assq_no_quit (monitor_object, watch_list); if (CONSP (watch_object)) @@ -203,10 +202,10 @@ will be reported only in case of the `moved' event. */) if (! monitor) xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file); - Lisp_Object watch_descriptor = make_pointer_integer (monitor); + Lisp_Object watch_descriptor = make_pointer_integer_unsafe (monitor); - /* Check the dicey assumption that make_pointer_integer is safe. */ - if (! FIXNUMP (watch_descriptor)) + if (! (FIXNUMP (watch_descriptor) + && XFIXNUMPTR (watch_descriptor) == monitor)) { g_object_unref (monitor); xsignal2 (Qfile_notify_error, build_string ("Unsupported file watcher"), |