diff options
| author | Paul Eggert | 2011-06-19 11:32:55 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-19 11:32:55 -0700 |
| commit | 573f4b54074f81bff59d5da768da2d044d358fe1 (patch) | |
| tree | 9c3ccf9e567b45ca7337c2421dc9ccf708e9369d /src | |
| parent | 989f33ba6bda51e06241f2e5a7b07f9feb435057 (diff) | |
| download | emacs-573f4b54074f81bff59d5da768da2d044d358fe1.tar.gz emacs-573f4b54074f81bff59d5da768da2d044d358fe1.zip | |
* dbusbind.c (XD_ERROR): Don't arbitrarily truncate string.
(XD_DEBUG_MESSAGE): Don't waste a byte.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/dbusbind.c | 13 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 89d518a1a56..3a7cad71c35 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string. | ||
| 4 | (XD_DEBUG_MESSAGE): Don't waste a byte. | ||
| 5 | |||
| 3 | * callproc.c (getenv_internal_1, getenv_internal) | 6 | * callproc.c (getenv_internal_1, getenv_internal) |
| 4 | (Fgetenv_internal): | 7 | (Fgetenv_internal): |
| 5 | * buffer.c (init_buffer): Don't assume string length fits in 'int'. | 8 | * buffer.c (init_buffer): Don't assume string length fits in 'int'. |
diff --git a/src/dbusbind.c b/src/dbusbind.c index f662d5b38a2..302b93146fd 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -111,13 +111,12 @@ static int xd_in_read_queued_messages = 0; | |||
| 111 | /* Raise a Lisp error from a D-Bus ERROR. */ | 111 | /* Raise a Lisp error from a D-Bus ERROR. */ |
| 112 | #define XD_ERROR(error) \ | 112 | #define XD_ERROR(error) \ |
| 113 | do { \ | 113 | do { \ |
| 114 | char s[1024]; \ | ||
| 115 | strncpy (s, error.message, 1023); \ | ||
| 116 | dbus_error_free (&error); \ | ||
| 117 | /* Remove the trailing newline. */ \ | 114 | /* Remove the trailing newline. */ \ |
| 118 | if (strchr (s, '\n') != NULL) \ | 115 | char const *mess = error.message; \ |
| 119 | s[strlen (s) - 1] = '\0'; \ | 116 | char const *nl = strchr (mess, '\n'); \ |
| 120 | XD_SIGNAL1 (build_string (s)); \ | 117 | Lisp_Object err = make_string (mess, nl ? nl - mess : strlen (mess)); \ |
| 118 | dbus_error_free (&error); \ | ||
| 119 | XD_SIGNAL1 (err); \ | ||
| 121 | } while (0) | 120 | } while (0) |
| 122 | 121 | ||
| 123 | /* Macros for debugging. In order to enable them, build with | 122 | /* Macros for debugging. In order to enable them, build with |
| @@ -126,7 +125,7 @@ static int xd_in_read_queued_messages = 0; | |||
| 126 | #define XD_DEBUG_MESSAGE(...) \ | 125 | #define XD_DEBUG_MESSAGE(...) \ |
| 127 | do { \ | 126 | do { \ |
| 128 | char s[1024]; \ | 127 | char s[1024]; \ |
| 129 | snprintf (s, 1023, __VA_ARGS__); \ | 128 | snprintf (s, sizeof s, __VA_ARGS__); \ |
| 130 | printf ("%s: %s\n", __func__, s); \ | 129 | printf ("%s: %s\n", __func__, s); \ |
| 131 | message ("%s: %s", __func__, s); \ | 130 | message ("%s: %s", __func__, s); \ |
| 132 | } while (0) | 131 | } while (0) |