Commit 573f4b54 authored by Paul Eggert's avatar Paul Eggert
Browse files

* dbusbind.c (XD_ERROR): Don't arbitrarily truncate string.

(XD_DEBUG_MESSAGE): Don't waste a byte.
parent 989f33ba
2011-06-19 Paul Eggert <eggert@cs.ucla.edu> 2011-06-19 Paul Eggert <eggert@cs.ucla.edu>
* dbusbind.c (XD_ERROR): Don't arbitrarily truncate string.
(XD_DEBUG_MESSAGE): Don't waste a byte.
* callproc.c (getenv_internal_1, getenv_internal) * callproc.c (getenv_internal_1, getenv_internal)
(Fgetenv_internal): (Fgetenv_internal):
* buffer.c (init_buffer): Don't assume string length fits in 'int'. * buffer.c (init_buffer): Don't assume string length fits in 'int'.
......
...@@ -111,13 +111,12 @@ static int xd_in_read_queued_messages = 0; ...@@ -111,13 +111,12 @@ static int xd_in_read_queued_messages = 0;
/* Raise a Lisp error from a D-Bus ERROR. */ /* Raise a Lisp error from a D-Bus ERROR. */
#define XD_ERROR(error) \ #define XD_ERROR(error) \
do { \ do { \
char s[1024]; \
strncpy (s, error.message, 1023); \
dbus_error_free (&error); \
/* Remove the trailing newline. */ \ /* Remove the trailing newline. */ \
if (strchr (s, '\n') != NULL) \ char const *mess = error.message; \
s[strlen (s) - 1] = '\0'; \ char const *nl = strchr (mess, '\n'); \
XD_SIGNAL1 (build_string (s)); \ Lisp_Object err = make_string (mess, nl ? nl - mess : strlen (mess)); \
dbus_error_free (&error); \
XD_SIGNAL1 (err); \
} while (0) } while (0)
/* Macros for debugging. In order to enable them, build with /* Macros for debugging. In order to enable them, build with
...@@ -126,7 +125,7 @@ static int xd_in_read_queued_messages = 0; ...@@ -126,7 +125,7 @@ static int xd_in_read_queued_messages = 0;
#define XD_DEBUG_MESSAGE(...) \ #define XD_DEBUG_MESSAGE(...) \
do { \ do { \
char s[1024]; \ char s[1024]; \
snprintf (s, 1023, __VA_ARGS__); \ snprintf (s, sizeof s, __VA_ARGS__); \
printf ("%s: %s\n", __func__, s); \ printf ("%s: %s\n", __func__, s); \
message ("%s: %s", __func__, s); \ message ("%s: %s", __func__, s); \
} while (0) } while (0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment