diff options
-rw-r--r-- | meta-oe/recipes-support/libnih/libnih-1.0.3/libnih_1.0.3-4ubuntu16.patch | 3593 | ||||
-rw-r--r-- | meta-oe/recipes-support/libnih/libnih_1.0.3.bb | 38 |
2 files changed, 3631 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libnih/libnih-1.0.3/libnih_1.0.3-4ubuntu16.patch b/meta-oe/recipes-support/libnih/libnih-1.0.3/libnih_1.0.3-4ubuntu16.patch new file mode 100644 index 0000000000..5d125c8514 --- /dev/null +++ b/meta-oe/recipes-support/libnih/libnih-1.0.3/libnih_1.0.3-4ubuntu16.patch | |||
@@ -0,0 +1,3593 @@ | |||
1 | --- libnih-1.0.3.orig/ChangeLog | ||
2 | +++ libnih-1.0.3/ChangeLog | ||
3 | @@ -1,3 +1,84 @@ | ||
4 | +2013-03-13 Steve Langasek <steve.langasek@ubuntu.com> | ||
5 | + | ||
6 | + * nih/watch.c (nih_watch_walk_filter): New NihFileFilter function | ||
7 | + passed to nih_dir_walk_scan() to ensure the nih_watch_new() filter | ||
8 | + function is passed the NihWatch data rather than the data passed to | ||
9 | + the nih_dir_walk() NihFileVisitor function (LP: #776532). | ||
10 | + | ||
11 | + * nih/tests/test_watch.c (test_new): New test "with filter and data" | ||
12 | + to ensure filter is passed correct value. | ||
13 | + | ||
14 | +2013-02-28 James Hunt <james.hunt@ubuntu.com> | ||
15 | + | ||
16 | + * Removal of gcc 'malloc' function attribute resulting from | ||
17 | + a clarification in its description which makes its use invalid. | ||
18 | + (LP: #1123588). | ||
19 | + | ||
20 | +2013-02-05 James Hunt <james.hunt@ubuntu.com> | ||
21 | + | ||
22 | + * nih/logging.c: nih_log_abort_message(): Remove erroneous check | ||
23 | + left over from use of __abort_msg weak symbol. | ||
24 | + * nih/tests/test_logging.c: Remove unecessary check on whether | ||
25 | + __nih_abort_msg has an address. | ||
26 | + | ||
27 | +2012-12-13 Stéphane Graber <stgraber@ubuntu.com> | ||
28 | + | ||
29 | + * nih-dbus-tool/type.c, nih-dbus-tool/marshal.c: Update dbus code | ||
30 | + generator to allow for empty lists for type 'as'. This drops the | ||
31 | + != NULL check for NULL terminated arrays and moves the iteration | ||
32 | + loop inside an 'if' statement. | ||
33 | + | ||
34 | +2012-12-11 Dmitrijs Ledkovs <dmitrijs.ledkovs@canonical.com> | ||
35 | + | ||
36 | + * nih/file.c (nih_dir_walk_scan): Fallback to lstat, if the | ||
37 | + non-portable dirent.d_type is not available (LP: #672643) (Closes: | ||
38 | + #695604). | ||
39 | + | ||
40 | +2012-12-10 Petr Lautrbach <plautrba@redhat.com> | ||
41 | + | ||
42 | + * nih/tests/test_file.c: don't use dirent.d_type (not portable) | ||
43 | + | ||
44 | +2012-10-25 James Hunt <james.hunt@ubuntu.com> | ||
45 | + | ||
46 | + * nih/logging.c: Use our own __nih_abort_msg rather than the | ||
47 | + (e)glibc private symbol __abort_msg to avoid upgrade issues (LP: #997359). | ||
48 | + * nih/tests/test_logging.c: Update tests for __nih_abort_msg. | ||
49 | + | ||
50 | +2011-08-31 James Hunt <james.hunt@ubuntu.com> | ||
51 | + | ||
52 | + * nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c | ||
53 | + (test_unix_fd_to_str): Sanity check value before invoking strchr in | ||
54 | + case it returns address of null (which would give a misleading test | ||
55 | + pass). | ||
56 | + * nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c | ||
57 | + (test_unix_fd_to_str, test_unix_fd_to_str_sync): Sanity check value | ||
58 | + before invoking strchr in case it returns address of null (which would | ||
59 | + give a misleading test pass). | ||
60 | + * nih/config.c (): nih_config_block_end: Add check to ensure strchr() | ||
61 | + doesn't return address of null since this would result in a misleading | ||
62 | + return value of TRUE. | ||
63 | + | ||
64 | + * nih/string.c (nih_str_split): Fixes to avoid over-running | ||
65 | + input string and also returning an empty string array entry | ||
66 | + when repeat is true (LP: #834813). | ||
67 | + * nih/tests/test_string.c (test_str_split): Added a lot of new | ||
68 | + tests for nih_str_split(). | ||
69 | + | ||
70 | +2011-08-26 James Hunt <james.hunt@ubuntu.com> | ||
71 | + | ||
72 | + * nih/io.c (nih_io_select_fds): Ensure number of fds being managed | ||
73 | + is within limits. | ||
74 | + | ||
75 | + * nih/config.c, nih/error.h, nih/io.c, nih/test_files.h: Correct | ||
76 | + typos in comments. | ||
77 | + | ||
78 | +2011-06-20 James Hunt <james.hunt@ubuntu.com> | ||
79 | + | ||
80 | + * nih/watch.c (nih_watch_handle): Handle non-directory watches; | ||
81 | + previously a file watch resulted in an invalid file path ending in | ||
82 | + a single slash (LP:#777097). | ||
83 | + * nih/tests/test_watch.c: Added explicit test for watch on a file. | ||
84 | + | ||
85 | 2010-12-23 Scott James Remnant <scott@netsplit.com> | ||
86 | |||
87 | * NEWS: Release 1.0.3 | ||
88 | --- libnih-1.0.3.orig/nih/watch.c | ||
89 | +++ libnih-1.0.3/nih/watch.c | ||
90 | @@ -2,8 +2,8 @@ | ||
91 | * | ||
92 | * watch.c - watching of files and directories with inotify | ||
93 | * | ||
94 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
95 | - * Copyright © 2009 Canonical Ltd. | ||
96 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
97 | + * Copyright © 2011 Canonical Ltd. | ||
98 | * | ||
99 | * This program is free software; you can redistribute it and/or modify | ||
100 | * it under the terms of the GNU General Public License version 2, as | ||
101 | @@ -71,6 +71,9 @@ | ||
102 | uint32_t events, uint32_t cookie, | ||
103 | const char *name, | ||
104 | int *caught_free); | ||
105 | +static int nih_watch_walk_filter (void *data, const char *path, | ||
106 | + int is_dir) | ||
107 | + __attribute__ ((warn_unused_result)); | ||
108 | |||
109 | |||
110 | /** | ||
111 | @@ -91,7 +94,7 @@ | ||
112 | * sub-directories will be automatically watched. | ||
113 | * | ||
114 | * Additionally, the set of files and directories within @path can be | ||
115 | - * limited by passing a @filter function which will recieve the paths and | ||
116 | + * limited by passing a @filter function which will receive the paths and | ||
117 | * may return TRUE to indicate that the path received should not be watched. | ||
118 | * | ||
119 | * When a file is created within @path, or moved from outside this location | ||
120 | @@ -104,7 +107,7 @@ | ||
121 | * files that exist under @path when the watch is first added. This only | ||
122 | * occurs if the watch can be added. | ||
123 | * | ||
124 | - * This is a very high level wrapped around the inotify API; lower levels | ||
125 | + * This is a very high level wrapper around the inotify API; lower levels | ||
126 | * can be obtained using the inotify API itself and some of the helper | ||
127 | * functions used by this one. | ||
128 | * | ||
129 | @@ -185,6 +188,35 @@ | ||
130 | } | ||
131 | |||
132 | |||
133 | + /** | ||
134 | + * nih_watch_walk_filter: | ||
135 | + * @data: NihWatch, | ||
136 | + * @path: path to file, | ||
137 | + * @is_dir: TRUE if @path is a directory. | ||
138 | + * | ||
139 | + * Callback function for nih_dir_walk(), used by nih_watch_add() to wrap | ||
140 | + * the user-specified NihFileFilter (watch->filter) with a filter that can | ||
141 | + * take watch itself as an argument. | ||
142 | + * | ||
143 | + * Returns: TRUE if the path should be ignored, FALSE otherwise. | ||
144 | + **/ | ||
145 | +static int | ||
146 | +nih_watch_walk_filter (void *data, const char *path, int is_dir) | ||
147 | +{ | ||
148 | + NihWatch *watch; | ||
149 | + | ||
150 | + watch = (NihWatch *)data; | ||
151 | + | ||
152 | + nih_assert (watch); | ||
153 | + | ||
154 | + /* No filter, so accept all files */ | ||
155 | + if (! watch->filter) | ||
156 | + return FALSE; | ||
157 | + | ||
158 | + return watch->filter (watch->data, path, is_dir); | ||
159 | +} | ||
160 | + | ||
161 | + | ||
162 | /** | ||
163 | * nih_watch_handle_by_wd: | ||
164 | * @watch: watch to search, | ||
165 | @@ -295,7 +327,7 @@ | ||
166 | * one; errors within the walk are warned automatically, so if this | ||
167 | * fails, it means we literally couldn't watch the top-level. | ||
168 | */ | ||
169 | - if (subdirs && (nih_dir_walk (path, watch->filter, | ||
170 | + if (subdirs && (nih_dir_walk (path, nih_watch_walk_filter, | ||
171 | (NihFileVisitor)nih_watch_add_visitor, | ||
172 | NULL, watch) < 0)) { | ||
173 | NihError *err; | ||
174 | @@ -494,12 +526,21 @@ | ||
175 | return; | ||
176 | } | ||
177 | |||
178 | + /* Every other event must come with a name */ | ||
179 | + if (name && *name) { | ||
180 | |||
181 | - /* Every other event must come with a name. */ | ||
182 | - if ((! name) || strchr (name, '/')) | ||
183 | - return; | ||
184 | + /* If name refers to a directory, there should be no associated | ||
185 | + * path - just the name of the path element. | ||
186 | + */ | ||
187 | + if (strchr (name, '/')) | ||
188 | + return; | ||
189 | |||
190 | - path = NIH_MUST (nih_sprintf (NULL, "%s/%s", handle->path, name)); | ||
191 | + /* Event occured for file within a watched directory */ | ||
192 | + path = NIH_MUST (nih_sprintf (NULL, "%s/%s", handle->path, name)); | ||
193 | + } else { | ||
194 | + /* File event occured */ | ||
195 | + path = NIH_MUST (nih_strdup (NULL, handle->path)); | ||
196 | + } | ||
197 | |||
198 | /* Check the filter */ | ||
199 | if (watch->filter && watch->filter (watch->data, path, | ||
200 | --- libnih-1.0.3.orig/nih/hash.h | ||
201 | +++ libnih-1.0.3/nih/hash.h | ||
202 | @@ -141,7 +141,7 @@ | ||
203 | * @hash: hash table to iterate, | ||
204 | * @iter: name of iterator variable. | ||
205 | * | ||
206 | - * Expans to nested for statements that iterate over each entry in each | ||
207 | + * Expands to nested for statements that iterate over each entry in each | ||
208 | * bin of @hash, except for the bin head pointer, setting @iter to each | ||
209 | * entry for the block within the loop. A variable named _@iter_i is used | ||
210 | * to iterate the hash bins. | ||
211 | @@ -203,7 +203,7 @@ | ||
212 | NihKeyFunction key_function, | ||
213 | NihHashFunction hash_function, | ||
214 | NihCmpFunction cmp_function) | ||
215 | - __attribute__ ((warn_unused_result, malloc)); | ||
216 | + __attribute__ ((warn_unused_result)); | ||
217 | |||
218 | NihList * nih_hash_add (NihHash *hash, NihList *entry); | ||
219 | NihList * nih_hash_add_unique (NihHash *hash, NihList *entry); | ||
220 | --- libnih-1.0.3.orig/nih/main.h | ||
221 | +++ libnih-1.0.3/nih/main.h | ||
222 | @@ -138,7 +138,7 @@ | ||
223 | |||
224 | NihMainLoopFunc *nih_main_loop_add_func (const void *parent, | ||
225 | NihMainLoopCb callback, void *data) | ||
226 | - __attribute__ ((warn_unused_result, malloc)); | ||
227 | + __attribute__ ((warn_unused_result)); | ||
228 | |||
229 | void nih_main_term_signal (void *data, NihSignal *signal); | ||
230 | |||
231 | --- libnih-1.0.3.orig/nih/command.h | ||
232 | +++ libnih-1.0.3/nih/command.h | ||
233 | @@ -123,7 +123,7 @@ | ||
234 | |||
235 | NihCommand *nih_command_join (const void *parent, | ||
236 | const NihCommand *a, const NihCommand *b) | ||
237 | - __attribute__ ((warn_unused_result, malloc)); | ||
238 | + __attribute__ ((warn_unused_result)); | ||
239 | |||
240 | NIH_END_EXTERN | ||
241 | |||
242 | --- libnih-1.0.3.orig/nih/config.h | ||
243 | +++ libnih-1.0.3/nih/config.h | ||
244 | @@ -140,10 +140,10 @@ | ||
245 | char * nih_config_next_token (const void *parent, const char *file, | ||
246 | size_t len, size_t *pos, size_t *lineno, | ||
247 | const char *delim, int dequote) | ||
248 | - __attribute__ ((warn_unused_result, malloc)); | ||
249 | + __attribute__ ((warn_unused_result)); | ||
250 | char * nih_config_next_arg (const void *parent, const char *file, | ||
251 | size_t len, size_t *pos, size_t *lineno) | ||
252 | - __attribute__ ((warn_unused_result, malloc)); | ||
253 | + __attribute__ ((warn_unused_result)); | ||
254 | void nih_config_next_line (const char *file, size_t len, | ||
255 | size_t *pos, size_t *lineno); | ||
256 | |||
257 | @@ -155,15 +155,15 @@ | ||
258 | |||
259 | char ** nih_config_parse_args (const void *parent, const char *file, | ||
260 | size_t len, size_t *pos, size_t *lineno) | ||
261 | - __attribute__ ((warn_unused_result, malloc)); | ||
262 | + __attribute__ ((warn_unused_result)); | ||
263 | char * nih_config_parse_command (const void *parent, const char *file, | ||
264 | size_t len, size_t *pos, size_t *lineno) | ||
265 | - __attribute__ ((warn_unused_result, malloc)); | ||
266 | + __attribute__ ((warn_unused_result)); | ||
267 | |||
268 | char * nih_config_parse_block (const void *parent, const char *file, | ||
269 | size_t len, size_t *pos, size_t *lineno, | ||
270 | const char *type) | ||
271 | - __attribute__ ((warn_unused_result, malloc)); | ||
272 | + __attribute__ ((warn_unused_result)); | ||
273 | int nih_config_skip_block (const char *file, size_t len, | ||
274 | size_t *lineno, size_t *pos, | ||
275 | const char *type, size_t *endpos) | ||
276 | --- libnih-1.0.3.orig/nih/io.c | ||
277 | +++ libnih-1.0.3/nih/io.c | ||
278 | @@ -2,8 +2,8 @@ | ||
279 | * | ||
280 | * io.c - file and socket input/output handling | ||
281 | * | ||
282 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
283 | - * Copyright © 2009 Canonical Ltd. | ||
284 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
285 | + * Copyright © 2011 Canonical Ltd. | ||
286 | * | ||
287 | * This program is free software; you can redistribute it and/or modify | ||
288 | * it under the terms of the GNU General Public License version 2, as | ||
289 | @@ -165,6 +165,7 @@ | ||
290 | nih_assert (readfds != NULL); | ||
291 | nih_assert (writefds != NULL); | ||
292 | nih_assert (exceptfds != NULL); | ||
293 | + nih_assert (*nfds <= FD_SETSIZE); | ||
294 | |||
295 | nih_io_init (); | ||
296 | |||
297 | @@ -186,6 +187,9 @@ | ||
298 | *nfds = nih_max (*nfds, watch->fd + 1); | ||
299 | } | ||
300 | } | ||
301 | + | ||
302 | + /* Re-check in case we exceeded the limit in the loop */ | ||
303 | + nih_assert (*nfds <= FD_SETSIZE); | ||
304 | } | ||
305 | |||
306 | /** | ||
307 | @@ -901,7 +905,7 @@ | ||
308 | * read and placed into the receive buffer or queue, and the reader function | ||
309 | * is called if set. | ||
310 | * | ||
311 | - * Any data or messaages in the send buffer or queue are written out if the | ||
312 | + * Any data or messages in the send buffer or queue are written out if the | ||
313 | * @events includes NIH_IO_WRITE. | ||
314 | * | ||
315 | * Errors are handled when data is read, and result in the error handled | ||
316 | @@ -1211,7 +1215,7 @@ | ||
317 | * This function is called when the local end of a file descriptor being | ||
318 | * managed by NihIo should be closed. Usually this is because the remote | ||
319 | * end has been closed (without error) but it can also be because no | ||
320 | - * error handler was given | ||
321 | + * error handler was given. | ||
322 | * | ||
323 | * Normally this just calls the close handler, or if not available, it | ||
324 | * closes the file descriptor and frees the structure (which may be | ||
325 | @@ -1291,7 +1295,7 @@ | ||
326 | * @io: structure to be destroyed. | ||
327 | * | ||
328 | * Closes the file descriptor associated with an NihIo structure so that | ||
329 | - * the structure can be freed. IF an error is caught by closing the | ||
330 | + * the structure can be freed. If an error is caught by closing the | ||
331 | * descriptor, the error handler is called instead of the error being raised; | ||
332 | * this allows you to group your error handling in one place rather than | ||
333 | * special-case close. | ||
334 | --- libnih-1.0.3.orig/nih/watch.h | ||
335 | +++ libnih-1.0.3/nih/watch.h | ||
336 | @@ -156,7 +156,7 @@ | ||
337 | NihCreateHandler create_handler, | ||
338 | NihModifyHandler modify_handler, | ||
339 | NihDeleteHandler delete_handler, void *data) | ||
340 | - __attribute__ ((warn_unused_result, malloc)); | ||
341 | + __attribute__ ((warn_unused_result)); | ||
342 | |||
343 | int nih_watch_add (NihWatch *watch, const char *path, int subdirs) | ||
344 | __attribute__ ((warn_unused_result)); | ||
345 | --- libnih-1.0.3.orig/nih/tree.h | ||
346 | +++ libnih-1.0.3/nih/tree.h | ||
347 | @@ -344,9 +344,9 @@ | ||
348 | |||
349 | void nih_tree_init (NihTree *tree); | ||
350 | NihTree * nih_tree_new (const void *parent) | ||
351 | - __attribute__ ((warn_unused_result, malloc)); | ||
352 | + __attribute__ ((warn_unused_result)); | ||
353 | NihTreeEntry *nih_tree_entry_new (const void *parent) | ||
354 | - __attribute__ ((warn_unused_result, malloc)); | ||
355 | + __attribute__ ((warn_unused_result)); | ||
356 | |||
357 | NihTree * nih_tree_add (NihTree *tree, NihTree *node, | ||
358 | NihTreeWhere where); | ||
359 | --- libnih-1.0.3.orig/nih/file.c | ||
360 | +++ libnih-1.0.3/nih/file.c | ||
361 | @@ -65,7 +65,7 @@ | ||
362 | /* Prototypes for static functions */ | ||
363 | static char **nih_dir_walk_scan (const char *path, NihFileFilter filter, | ||
364 | void *data) | ||
365 | - __attribute__ ((warn_unused_result, malloc)); | ||
366 | + __attribute__ ((warn_unused_result)); | ||
367 | static int nih_dir_walk_visit (const char *dirname, NihList *dirs, | ||
368 | const char *path, NihFileFilter filter, | ||
369 | NihFileVisitor visitor, | ||
370 | @@ -619,6 +619,8 @@ | ||
371 | struct dirent *ent; | ||
372 | char **paths; | ||
373 | size_t npaths; | ||
374 | + int isdir; | ||
375 | + struct stat statbuf; | ||
376 | |||
377 | nih_assert (path != NULL); | ||
378 | |||
379 | @@ -640,7 +642,15 @@ | ||
380 | subpath = NIH_MUST (nih_sprintf (NULL, "%s/%s", | ||
381 | path, ent->d_name)); | ||
382 | |||
383 | - if (filter && filter (data, subpath, ent->d_type == DT_DIR)) | ||
384 | + if (ent->d_type == DT_UNKNOWN) { | ||
385 | + if ( lstat (subpath, &statbuf)) | ||
386 | + isdir = 0; | ||
387 | + else | ||
388 | + isdir = S_ISDIR(statbuf.st_mode); | ||
389 | + } else | ||
390 | + isdir = ent->d_type == DT_DIR; | ||
391 | + | ||
392 | + if (filter && filter (data, subpath, isdir)) | ||
393 | continue; | ||
394 | |||
395 | NIH_MUST (nih_str_array_addp (&paths, NULL, &npaths, subpath)); | ||
396 | --- libnih-1.0.3.orig/nih/alloc.c | ||
397 | +++ libnih-1.0.3/nih/alloc.c | ||
398 | @@ -119,8 +119,7 @@ | ||
399 | static inline int nih_alloc_context_free (NihAllocCtx *ctx); | ||
400 | |||
401 | static inline NihAllocRef *nih_alloc_ref_new (NihAllocCtx *parent, | ||
402 | - NihAllocCtx *child) | ||
403 | - __attribute__ ((malloc)); | ||
404 | + NihAllocCtx *child); | ||
405 | static inline void nih_alloc_ref_free (NihAllocRef *ref); | ||
406 | static inline NihAllocRef *nih_alloc_ref_lookup (NihAllocCtx *parent, | ||
407 | NihAllocCtx *child); | ||
408 | --- libnih-1.0.3.orig/nih/timer.h | ||
409 | +++ libnih-1.0.3/nih/timer.h | ||
410 | @@ -59,7 +59,7 @@ | ||
411 | * @months: months (1-12), | ||
412 | * @wdays: days of week (0-7). | ||
413 | * | ||
414 | - * Indidcates when scheduled timers should be run, each member is a bit | ||
415 | + * Indicates when scheduled timers should be run, each member is a bit | ||
416 | * field where the bit is 1 if the timer should be run for that value and | ||
417 | * 0 if not. | ||
418 | **/ | ||
419 | @@ -117,14 +117,14 @@ | ||
420 | |||
421 | NihTimer *nih_timer_add_timeout (const void *parent, time_t timeout, | ||
422 | NihTimerCb callback, void *data) | ||
423 | - __attribute__ ((warn_unused_result, malloc)); | ||
424 | + __attribute__ ((warn_unused_result)); | ||
425 | NihTimer *nih_timer_add_periodic (const void *parent, time_t period, | ||
426 | NihTimerCb callback, void *data) | ||
427 | - __attribute__ ((warn_unused_result, malloc)); | ||
428 | + __attribute__ ((warn_unused_result)); | ||
429 | NihTimer *nih_timer_add_scheduled (const void *parent, | ||
430 | NihTimerSchedule *schedule, | ||
431 | NihTimerCb callback, void *data) | ||
432 | - __attribute__ ((warn_unused_result, malloc)); | ||
433 | + __attribute__ ((warn_unused_result)); | ||
434 | |||
435 | NihTimer *nih_timer_next_due (void); | ||
436 | void nih_timer_poll (void); | ||
437 | --- libnih-1.0.3.orig/nih/config.c | ||
438 | +++ libnih-1.0.3/nih/config.c | ||
439 | @@ -2,8 +2,8 @@ | ||
440 | * | ||
441 | * config.c - configuration file parsing | ||
442 | * | ||
443 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
444 | - * Copyright © 2009 Canonical Ltd. | ||
445 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
446 | + * Copyright © 2011 Canonical Ltd. | ||
447 | * | ||
448 | * This program is free software; you can redistribute it and/or modify | ||
449 | * it under the terms of the GNU General Public License version 2, as | ||
450 | @@ -657,7 +657,7 @@ | ||
451 | * of the returned string are freed, the returned string will also be | ||
452 | * freed. | ||
453 | * | ||
454 | - * Returns: the command found or NULL on raised error. | ||
455 | + * Returns: the newly allocated command found or NULL on raised error. | ||
456 | **/ | ||
457 | char * | ||
458 | nih_config_parse_command (const void *parent, | ||
459 | @@ -714,7 +714,7 @@ | ||
460 | * @lineno: line number, | ||
461 | * @type: block identifier. | ||
462 | * | ||
463 | - * Extracts a block of text from @line, stopping when the pharse "end @type" | ||
464 | + * Extracts a block of text from @line, stopping when the phrase "end @type" | ||
465 | * is encountered without any quotes or blackslash escaping within it. | ||
466 | * | ||
467 | * @file may be a memory mapped file, in which case @pos should be given | ||
468 | @@ -950,7 +950,7 @@ | ||
469 | return FALSE; | ||
470 | |||
471 | /* Must be whitespace after */ | ||
472 | - if (! strchr (NIH_CONFIG_WS, file[p + 3])) | ||
473 | + if (file[p + 3] && ! strchr (NIH_CONFIG_WS, file[p + 3])) | ||
474 | return FALSE; | ||
475 | |||
476 | /* Find the second word */ | ||
477 | --- libnih-1.0.3.orig/nih/option.h | ||
478 | +++ libnih-1.0.3/nih/option.h | ||
479 | @@ -124,11 +124,11 @@ | ||
480 | char ** nih_option_parser (const void *parent, | ||
481 | int argc, char *argv[], | ||
482 | NihOption *options, int break_nonopt) | ||
483 | - __attribute__ ((warn_unused_result, malloc)); | ||
484 | + __attribute__ ((warn_unused_result)); | ||
485 | |||
486 | NihOption *nih_option_join (const void *parent, | ||
487 | const NihOption *a, const NihOption *b) | ||
488 | - __attribute__ ((warn_unused_result, malloc)); | ||
489 | + __attribute__ ((warn_unused_result)); | ||
490 | |||
491 | int nih_option_count (NihOption *option, const char *arg); | ||
492 | int nih_option_int (NihOption *option, const char *arg); | ||
493 | --- libnih-1.0.3.orig/nih/signal.h | ||
494 | +++ libnih-1.0.3/nih/signal.h | ||
495 | @@ -76,7 +76,7 @@ | ||
496 | |||
497 | NihSignal * nih_signal_add_handler (const void *parent, int signum, | ||
498 | NihSignalHandler handler, void *data) | ||
499 | - __attribute__ ((warn_unused_result, malloc)); | ||
500 | + __attribute__ ((warn_unused_result)); | ||
501 | |||
502 | void nih_signal_handler (int signum); | ||
503 | void nih_signal_poll (void); | ||
504 | --- libnih-1.0.3.orig/nih/list.h | ||
505 | +++ libnih-1.0.3/nih/list.h | ||
506 | @@ -37,7 +37,7 @@ | ||
507 | * after a known entry, and remove an entry from the list. | ||
508 | * | ||
509 | * List entries may be created in one of two ways. The most common is to | ||
510 | - * embed the NihList structure as the frist member of your own structure, | ||
511 | + * embed the NihList structure as the first member of your own structure, | ||
512 | * and initialise it with nih_list_init() after allocating the structure. | ||
513 | * Alternatively you may create NihListEntry structures with | ||
514 | * nih_list_entry_new() and point at your own data from them. | ||
515 | @@ -196,10 +196,10 @@ | ||
516 | |||
517 | void nih_list_init (NihList *entry); | ||
518 | NihList * nih_list_new (const void *parent) | ||
519 | - __attribute__ ((warn_unused_result, malloc)); | ||
520 | + __attribute__ ((warn_unused_result)); | ||
521 | |||
522 | NihListEntry *nih_list_entry_new (const void *parent) | ||
523 | - __attribute__ ((warn_unused_result, malloc)); | ||
524 | + __attribute__ ((warn_unused_result)); | ||
525 | |||
526 | |||
527 | NihList * nih_list_add (NihList *list, NihList *entry); | ||
528 | --- libnih-1.0.3.orig/nih/logging.c | ||
529 | +++ libnih-1.0.3/nih/logging.c | ||
530 | @@ -39,11 +39,11 @@ | ||
531 | |||
532 | |||
533 | /** | ||
534 | - * __abort_msg: | ||
535 | + * __nih_abort_msg: | ||
536 | * | ||
537 | - * A glibc variable that keeps the assertion message in the core dump. | ||
538 | + * A variable that keeps the assertion message in the core dump. | ||
539 | **/ | ||
540 | -extern char *__abort_msg __attribute__ ((weak)); | ||
541 | +char *__nih_abort_msg = NULL; | ||
542 | |||
543 | /** | ||
544 | * logger: | ||
545 | @@ -114,19 +114,16 @@ | ||
546 | * nih_log_abort_message: | ||
547 | * @message: message to be logged. | ||
548 | * | ||
549 | - * Save @message in the glibc __abort_msg variable so it can be retrieved | ||
550 | + * Save @message in the __nih_abort_msg variable so it can be retrieved | ||
551 | * by debuggers if we should crash at this point. | ||
552 | **/ | ||
553 | static void | ||
554 | nih_log_abort_message (const char *message) | ||
555 | { | ||
556 | - if (! &__abort_msg) | ||
557 | - return; | ||
558 | + if (__nih_abort_msg) | ||
559 | + nih_discard (__nih_abort_msg); | ||
560 | |||
561 | - if (__abort_msg) | ||
562 | - nih_discard (__abort_msg); | ||
563 | - | ||
564 | - __abort_msg = NIH_MUST (nih_strdup (NULL, message)); | ||
565 | + __nih_abort_msg = NIH_MUST (nih_strdup (NULL, message)); | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | --- libnih-1.0.3.orig/nih/test_files.h | ||
570 | +++ libnih-1.0.3/nih/test_files.h | ||
571 | @@ -1,7 +1,7 @@ | ||
572 | /* libnih | ||
573 | * | ||
574 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
575 | - * Copyright © 2009 Canonical Ltd. | ||
576 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
577 | + * Copyright © 2011 Canonical Ltd. | ||
578 | * | ||
579 | * This program is free software; you can redistribute it and/or modify | ||
580 | * it under the terms of the GNU General Public License version 2, as | ||
581 | @@ -39,7 +39,7 @@ | ||
582 | * TEST_FILENAME: | ||
583 | * @_var: variable to store filename in. | ||
584 | * | ||
585 | - * Generate a filename that may be used for testing, it's unlinked it if | ||
586 | + * Generate a filename that may be used for testing, it's unlinked if it | ||
587 | * exists and it's up to you to unlink it when done. @_var should be at | ||
588 | * least PATH_MAX long. | ||
589 | **/ | ||
590 | --- libnih-1.0.3.orig/nih/test_process.h | ||
591 | +++ libnih-1.0.3/nih/test_process.h | ||
592 | @@ -36,7 +36,7 @@ | ||
593 | * Spawn a child in which a test can be performed without affecting the | ||
594 | * main flow of the process. The pid of the child is stored in @_pid. | ||
595 | * | ||
596 | - * This macro ensures that the child has begun exectution before the | ||
597 | + * This macro ensures that the child has begun execution before the | ||
598 | * parent is allowed to continue through the usual use of a pipe. | ||
599 | * | ||
600 | * A block of code should follow this macro, which is the code that will | ||
601 | --- libnih-1.0.3.orig/nih/child.h | ||
602 | +++ libnih-1.0.3/nih/child.h | ||
603 | @@ -98,7 +98,7 @@ | ||
604 | NihChildWatch *nih_child_add_watch (const void *parent, pid_t pid, | ||
605 | NihChildEvents events, | ||
606 | NihChildHandler handler, void *data) | ||
607 | - __attribute__ ((warn_unused_result, malloc)); | ||
608 | + __attribute__ ((warn_unused_result)); | ||
609 | |||
610 | void nih_child_poll (void); | ||
611 | |||
612 | --- libnih-1.0.3.orig/nih/alloc.h | ||
613 | +++ libnih-1.0.3/nih/alloc.h | ||
614 | @@ -299,7 +299,7 @@ | ||
615 | * It is permissible to take references to foo within its scope, or by | ||
616 | * functions called, in which case it will not be freed. Also it is | ||
617 | * generally nonsensical to allocate with a parent, since this too will | ||
618 | - * prevent it from beign freed. | ||
619 | + * prevent it from being freed. | ||
620 | **/ | ||
621 | #define nih_local __attribute__ ((cleanup(_nih_discard_local))) | ||
622 | |||
623 | @@ -307,11 +307,11 @@ | ||
624 | NIH_BEGIN_EXTERN | ||
625 | |||
626 | void * nih_alloc (const void *parent, size_t size) | ||
627 | - __attribute__ ((warn_unused_result, malloc)); | ||
628 | + __attribute__ ((warn_unused_result)); | ||
629 | |||
630 | void * nih_realloc (void *ptr, const void *parent, | ||
631 | size_t size) | ||
632 | - __attribute__ ((warn_unused_result, malloc)); | ||
633 | + __attribute__ ((warn_unused_result)); | ||
634 | |||
635 | int nih_free (void *ptr); | ||
636 | int nih_discard (void *ptr); | ||
637 | --- libnih-1.0.3.orig/nih/io.h | ||
638 | +++ libnih-1.0.3/nih/io.h | ||
639 | @@ -269,7 +269,7 @@ | ||
640 | NihIoWatch * nih_io_add_watch (const void *parent, int fd, | ||
641 | NihIoEvents events, | ||
642 | NihIoWatcher watcher, void *data) | ||
643 | - __attribute__ ((warn_unused_result, malloc)); | ||
644 | + __attribute__ ((warn_unused_result)); | ||
645 | |||
646 | void nih_io_select_fds (int *nfds, fd_set *readfds, | ||
647 | fd_set *writefds, fd_set *exceptfds); | ||
648 | @@ -278,12 +278,12 @@ | ||
649 | |||
650 | |||
651 | NihIoBuffer * nih_io_buffer_new (const void *parent) | ||
652 | - __attribute__ ((warn_unused_result, malloc)); | ||
653 | + __attribute__ ((warn_unused_result)); | ||
654 | |||
655 | int nih_io_buffer_resize (NihIoBuffer *buffer, size_t grow); | ||
656 | char * nih_io_buffer_pop (const void *parent, | ||
657 | NihIoBuffer *buffer, size_t *len) | ||
658 | - __attribute__ ((warn_unused_result, malloc)); | ||
659 | + __attribute__ ((warn_unused_result)); | ||
660 | void nih_io_buffer_shrink (NihIoBuffer *buffer, size_t len); | ||
661 | int nih_io_buffer_push (NihIoBuffer *buffer, | ||
662 | const char *str, size_t len) | ||
663 | @@ -291,7 +291,7 @@ | ||
664 | |||
665 | |||
666 | NihIoMessage *nih_io_message_new (const void *parent) | ||
667 | - __attribute__ ((warn_unused_result, malloc)); | ||
668 | + __attribute__ ((warn_unused_result)); | ||
669 | |||
670 | int nih_io_message_add_control (NihIoMessage *message, int level, | ||
671 | int type, socklen_t len, | ||
672 | @@ -300,7 +300,7 @@ | ||
673 | |||
674 | NihIoMessage *nih_io_message_recv (const void *parent, int fd, | ||
675 | size_t *len) | ||
676 | - __attribute__ ((warn_unused_result, malloc)); | ||
677 | + __attribute__ ((warn_unused_result)); | ||
678 | ssize_t nih_io_message_send (NihIoMessage *message, int fd) | ||
679 | __attribute__ ((warn_unused_result)); | ||
680 | |||
681 | @@ -310,7 +310,7 @@ | ||
682 | NihIoCloseHandler close_handler, | ||
683 | NihIoErrorHandler error_handler, | ||
684 | void *data) | ||
685 | - __attribute__ ((warn_unused_result, malloc)); | ||
686 | + __attribute__ ((warn_unused_result)); | ||
687 | void nih_io_shutdown (NihIo *io); | ||
688 | int nih_io_destroy (NihIo *io); | ||
689 | |||
690 | @@ -319,14 +319,14 @@ | ||
691 | |||
692 | char * nih_io_read (const void *parent, NihIo *io, | ||
693 | size_t *len) | ||
694 | - __attribute__ ((warn_unused_result, malloc)); | ||
695 | + __attribute__ ((warn_unused_result)); | ||
696 | int nih_io_write (NihIo *io, const char *str, | ||
697 | size_t len) | ||
698 | __attribute__ ((warn_unused_result)); | ||
699 | |||
700 | char * nih_io_get (const void *parent, NihIo *io, | ||
701 | const char *delim) | ||
702 | - __attribute__ ((warn_unused_result, malloc)); | ||
703 | + __attribute__ ((warn_unused_result)); | ||
704 | |||
705 | int nih_io_printf (NihIo *io, const char *format, ...) | ||
706 | __attribute__ ((warn_unused_result, format (printf, 2, 3))); | ||
707 | --- libnih-1.0.3.orig/nih/test_output.h | ||
708 | +++ libnih-1.0.3/nih/test_output.h | ||
709 | @@ -61,10 +61,10 @@ | ||
710 | |||
711 | /** | ||
712 | * TEST_FEATURE: | ||
713 | - * @_feat: name of function feature being tested. | ||
714 | + * @_feat: name of function or group feature being tested. | ||
715 | * | ||
716 | - * Output a message indicating that a sub-test of a function is being | ||
717 | - * performed, specifically the feature named _feat. | ||
718 | + * Output a message indicating that a sub-test of a function or | ||
719 | + * group is being performed, specifically the feature named _feat. | ||
720 | **/ | ||
721 | #define TEST_FEATURE(_feat) \ | ||
722 | printf ("...%s\n", _feat); | ||
723 | --- libnih-1.0.3.orig/nih/error.h | ||
724 | +++ libnih-1.0.3/nih/error.h | ||
725 | @@ -1,7 +1,7 @@ | ||
726 | /* libnih | ||
727 | * | ||
728 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
729 | - * Copyright © 2009 Canonical Ltd. | ||
730 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
731 | + * Copyright © 2011 Canonical Ltd. | ||
732 | * | ||
733 | * This program is free software; you can redistribute it and/or modify | ||
734 | * it under the terms of the GNU General Public License version 2, as | ||
735 | @@ -111,7 +111,7 @@ | ||
736 | * @message: human-readable message. | ||
737 | * | ||
738 | * Raises an error with the given details in the current error context, | ||
739 | - * if an unhandled error already exists then an error message is emmitted | ||
740 | + * if an unhandled error already exists then an error message is emitted | ||
741 | * through the logging system; you should try to avoid this. | ||
742 | * | ||
743 | * @message should be a static string, as it will not be freed when the | ||
744 | @@ -126,7 +126,7 @@ | ||
745 | * @format: format string for human-readable message. | ||
746 | * | ||
747 | * Raises an error with the given details in the current error context, | ||
748 | - * if an unhandled error already exists then an error message is emmitted | ||
749 | + * if an unhandled error already exists then an error message is emitted | ||
750 | * through the logging system; you should try to avoid this. | ||
751 | * | ||
752 | * The human-readable message for the error is parsed according to @format, | ||
753 | @@ -140,7 +140,7 @@ | ||
754 | * nih_error_raise_system: | ||
755 | * | ||
756 | * Raises an error with details taken from the current value of errno, | ||
757 | - * if an unhandled error already exists then an error message is emmitted | ||
758 | + * if an unhandled error already exists then an error message is emitted | ||
759 | * through the logging system; you should try to avoid this. | ||
760 | **/ | ||
761 | #define nih_error_raise_system() \ | ||
762 | @@ -162,7 +162,7 @@ | ||
763 | * @error: existing object to raise. | ||
764 | * | ||
765 | * Raises the existing error object in the current error context, | ||
766 | - * if an unhandled error already exists then an error message is emmitted | ||
767 | + * if an unhandled error already exists then an error message is emitted | ||
768 | * through the logging system; you should try to avoid this. | ||
769 | * | ||
770 | * This is normally used to raise a taken error that has not been handled, | ||
771 | @@ -182,7 +182,7 @@ | ||
772 | * @message: human-readable message. | ||
773 | * | ||
774 | * Raises an error with the given details in the current error context, | ||
775 | - * if an unhandled error already exists then an error message is emmitted | ||
776 | + * if an unhandled error already exists then an error message is emitted | ||
777 | * through the logging system; you should try to avoid this. | ||
778 | * | ||
779 | * Will return from the current function with @retval, which may be left | ||
780 | @@ -199,7 +199,7 @@ | ||
781 | * @retval: return value for function. | ||
782 | * | ||
783 | * Raises an error with details taken from the current value of errno, | ||
784 | - * if an unhandled error already exists then an error message is emmitted | ||
785 | + * if an unhandled error already exists then an error message is emitted | ||
786 | * through the logging system; you should try to avoid this. | ||
787 | * | ||
788 | * Will return from the current function with @retval, which may be left | ||
789 | --- libnih-1.0.3.orig/nih/string.h | ||
790 | +++ libnih-1.0.3/nih/string.h | ||
791 | @@ -35,60 +35,60 @@ | ||
792 | NIH_BEGIN_EXTERN | ||
793 | |||
794 | char * nih_sprintf (const void *parent, const char *format, ...) | ||
795 | - __attribute__ ((format (printf, 2, 3), warn_unused_result, malloc)); | ||
796 | + __attribute__ ((format (printf, 2, 3), warn_unused_result)); | ||
797 | |||
798 | char * nih_vsprintf (const void *parent, const char *format, | ||
799 | va_list args) | ||
800 | - __attribute__ ((format (printf, 2, 0), warn_unused_result, malloc)); | ||
801 | + __attribute__ ((format (printf, 2, 0), warn_unused_result)); | ||
802 | |||
803 | char * nih_strdup (const void *parent, const char *str) | ||
804 | - __attribute__ ((warn_unused_result, malloc)); | ||
805 | + __attribute__ ((warn_unused_result)); | ||
806 | |||
807 | char * nih_strndup (const void *parent, const char *str, size_t len) | ||
808 | - __attribute__ ((warn_unused_result, malloc)); | ||
809 | + __attribute__ ((warn_unused_result)); | ||
810 | |||
811 | char * nih_strcat (char **str, const void *parent, const char *src) | ||
812 | - __attribute__ ((warn_unused_result, malloc)); | ||
813 | + __attribute__ ((warn_unused_result)); | ||
814 | char * nih_strncat (char **str, const void *parent, const char *src, | ||
815 | size_t len) | ||
816 | - __attribute__ ((warn_unused_result, malloc)); | ||
817 | + __attribute__ ((warn_unused_result)); | ||
818 | |||
819 | char * nih_strcat_sprintf (char **str, const void *parent, | ||
820 | const char *format, ...) | ||
821 | - __attribute__ ((format (printf, 3, 4), warn_unused_result, malloc)); | ||
822 | + __attribute__ ((format (printf, 3, 4), warn_unused_result)); | ||
823 | char * nih_strcat_vsprintf (char **str, const void *parent, | ||
824 | const char *format, va_list args) | ||
825 | - __attribute__ ((format (printf, 3, 0), warn_unused_result, malloc)); | ||
826 | + __attribute__ ((format (printf, 3, 0), warn_unused_result)); | ||
827 | |||
828 | char **nih_str_split (const void *parent, const char *str, | ||
829 | const char *delim, int repeat) | ||
830 | - __attribute__ ((warn_unused_result, malloc)); | ||
831 | + __attribute__ ((warn_unused_result)); | ||
832 | |||
833 | char **nih_str_array_new (const void *parent) | ||
834 | - __attribute__ ((warn_unused_result, malloc)); | ||
835 | + __attribute__ ((warn_unused_result)); | ||
836 | char **nih_str_array_add (char ***array, const void *parent, size_t *len, | ||
837 | const char *str) | ||
838 | - __attribute__ ((warn_unused_result, malloc)); | ||
839 | + __attribute__ ((warn_unused_result)); | ||
840 | char **nih_str_array_addn (char ***array, const void *parent, size_t *len, | ||
841 | const char *str, size_t strlen) | ||
842 | - __attribute__ ((warn_unused_result, malloc)); | ||
843 | + __attribute__ ((warn_unused_result)); | ||
844 | char **nih_str_array_addp (char ***array, const void *parent, size_t *len, | ||
845 | void *ptr) | ||
846 | - __attribute__ ((warn_unused_result, malloc)); | ||
847 | + __attribute__ ((warn_unused_result)); | ||
848 | char **nih_str_array_copy (const void *parent, size_t *len, | ||
849 | char * const *array) | ||
850 | - __attribute__ ((warn_unused_result, malloc)); | ||
851 | + __attribute__ ((warn_unused_result)); | ||
852 | char **nih_str_array_append (char ***array, const void *parent, size_t *len, | ||
853 | char * const *args) | ||
854 | - __attribute__ ((warn_unused_result, malloc)); | ||
855 | + __attribute__ ((warn_unused_result)); | ||
856 | |||
857 | char * nih_str_wrap (const void *parent, const char *str, size_t len, | ||
858 | size_t first_indent, size_t indent) | ||
859 | - __attribute__ ((warn_unused_result, malloc)); | ||
860 | + __attribute__ ((warn_unused_result)); | ||
861 | size_t nih_str_screen_width (void); | ||
862 | char * nih_str_screen_wrap (const void *parent, const char *str, | ||
863 | size_t first_indent, size_t indent) | ||
864 | - __attribute__ ((warn_unused_result, malloc)); | ||
865 | + __attribute__ ((warn_unused_result)); | ||
866 | |||
867 | NIH_END_EXTERN | ||
868 | |||
869 | --- libnih-1.0.3.orig/nih/string.c | ||
870 | +++ libnih-1.0.3/nih/string.c | ||
871 | @@ -405,7 +405,7 @@ | ||
872 | const char *ptr; | ||
873 | |||
874 | /* Skip initial delimiters */ | ||
875 | - while (repeat && strchr (delim, *str)) | ||
876 | + while (repeat && *str && strchr (delim, *str)) | ||
877 | str++; | ||
878 | |||
879 | /* Find the end of the token */ | ||
880 | @@ -413,6 +413,13 @@ | ||
881 | while (*str && (! strchr (delim, *str))) | ||
882 | str++; | ||
883 | |||
884 | + /* Don't create an empty string array element in repeat | ||
885 | + * mode if there is no token (as a result of a | ||
886 | + * duplicated delimiter character). | ||
887 | + */ | ||
888 | + if (repeat && (str == ptr)) | ||
889 | + continue; | ||
890 | + | ||
891 | if (! nih_str_array_addn (&array, parent, &len, | ||
892 | ptr, str - ptr)) { | ||
893 | nih_free (array); | ||
894 | --- libnih-1.0.3.orig/nih/file.h | ||
895 | +++ libnih-1.0.3/nih/file.h | ||
896 | @@ -82,7 +82,7 @@ | ||
897 | |||
898 | char *nih_file_read (const void *parent, const char *path, | ||
899 | size_t *length) | ||
900 | - __attribute__ ((warn_unused_result, malloc)); | ||
901 | + __attribute__ ((warn_unused_result)); | ||
902 | |||
903 | void *nih_file_map (const char *path, int flags, size_t *length) | ||
904 | __attribute__ ((warn_unused_result)); | ||
905 | --- libnih-1.0.3.orig/nih/tests/test_option.c | ||
906 | +++ libnih-1.0.3/nih/tests/test_option.c | ||
907 | @@ -1574,7 +1574,7 @@ | ||
908 | output = tmpfile (); | ||
909 | TEST_CHILD (pid) { | ||
910 | TEST_DIVERT_STDOUT (output) { | ||
911 | - char **args; | ||
912 | + char **args __attribute__((unused)); | ||
913 | |||
914 | args = nih_option_parser (NULL, argc, argv, | ||
915 | options, FALSE); | ||
916 | @@ -1652,7 +1652,7 @@ | ||
917 | unsetenv ("COLUMNS"); | ||
918 | |||
919 | TEST_DIVERT_STDOUT (output) { | ||
920 | - char **args; | ||
921 | + char **args __attribute__((unused)); | ||
922 | |||
923 | args = nih_option_parser (NULL, argc, argv, | ||
924 | options, FALSE); | ||
925 | --- libnih-1.0.3.orig/nih/tests/test_logging.c | ||
926 | +++ libnih-1.0.3/nih/tests/test_logging.c | ||
927 | @@ -31,7 +31,7 @@ | ||
928 | #include <nih/main.h> | ||
929 | |||
930 | |||
931 | -extern char *__abort_msg __attribute__ ((weak)); | ||
932 | +extern char *__nih_abort_msg; | ||
933 | |||
934 | static NihLogLevel last_priority = NIH_LOG_UNKNOWN; | ||
935 | static char * last_message = NULL; | ||
936 | @@ -156,68 +156,63 @@ | ||
937 | } | ||
938 | |||
939 | |||
940 | - /* Check that a fatal message is also stored in the glibc __abort_msg | ||
941 | + /* Check that a fatal message is also stored in the __nih_abort_msg | ||
942 | * variable. | ||
943 | */ | ||
944 | - if (&__abort_msg) { | ||
945 | - TEST_FEATURE ("with fatal message"); | ||
946 | - TEST_ALLOC_FAIL { | ||
947 | - __abort_msg = NULL; | ||
948 | - last_priority = NIH_LOG_UNKNOWN; | ||
949 | - last_message = NULL; | ||
950 | - | ||
951 | - ret = nih_log_message (NIH_LOG_FATAL, | ||
952 | - "message with %s %d formatting", | ||
953 | - "some", 20); | ||
954 | - | ||
955 | - TEST_EQ (ret, 0); | ||
956 | - TEST_EQ (last_priority, NIH_LOG_FATAL); | ||
957 | - TEST_EQ_STR (last_message, "message with some 20 formatting"); | ||
958 | - | ||
959 | - TEST_NE_P (__abort_msg, NULL); | ||
960 | - TEST_ALLOC_PARENT (__abort_msg, NULL); | ||
961 | - TEST_EQ_STR (__abort_msg, "message with some 20 formatting"); | ||
962 | + TEST_FEATURE ("with fatal message"); | ||
963 | + TEST_ALLOC_FAIL { | ||
964 | + __nih_abort_msg = NULL; | ||
965 | + last_priority = NIH_LOG_UNKNOWN; | ||
966 | + last_message = NULL; | ||
967 | |||
968 | - free (last_message); | ||
969 | - } | ||
970 | + ret = nih_log_message (NIH_LOG_FATAL, | ||
971 | + "message with %s %d formatting", | ||
972 | + "some", 20); | ||
973 | |||
974 | + TEST_EQ (ret, 0); | ||
975 | + TEST_EQ (last_priority, NIH_LOG_FATAL); | ||
976 | + TEST_EQ_STR (last_message, "message with some 20 formatting"); | ||
977 | |||
978 | - /* Check that a fatal message can safely overwrite one already stored | ||
979 | - * in the glibc __abort_msg variable. | ||
980 | - */ | ||
981 | - TEST_FEATURE ("with second fatal message"); | ||
982 | - TEST_ALLOC_FAIL { | ||
983 | - TEST_ALLOC_SAFE { | ||
984 | - msg = nih_strdup (NULL, "test"); | ||
985 | - } | ||
986 | - | ||
987 | - __abort_msg = msg; | ||
988 | - TEST_FREE_TAG (msg); | ||
989 | - | ||
990 | - last_priority = NIH_LOG_UNKNOWN; | ||
991 | - last_message = NULL; | ||
992 | - | ||
993 | - ret = nih_log_message (NIH_LOG_FATAL, | ||
994 | - "message with %s %d formatting", | ||
995 | - "some", 20); | ||
996 | - | ||
997 | - TEST_EQ (ret, 0); | ||
998 | - TEST_EQ (last_priority, NIH_LOG_FATAL); | ||
999 | - TEST_EQ_STR (last_message, "message with some 20 formatting"); | ||
1000 | - | ||
1001 | - TEST_FREE (msg); | ||
1002 | - | ||
1003 | - TEST_NE_P (__abort_msg, NULL); | ||
1004 | - TEST_ALLOC_PARENT (__abort_msg, NULL); | ||
1005 | - TEST_EQ_STR (__abort_msg, "message with some 20 formatting"); | ||
1006 | + TEST_NE_P (__nih_abort_msg, NULL); | ||
1007 | + TEST_ALLOC_PARENT (__nih_abort_msg, NULL); | ||
1008 | + TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting"); | ||
1009 | |||
1010 | - free (last_message); | ||
1011 | - } | ||
1012 | - } else { | ||
1013 | - printf ("SKIP: __abort_msg not available\n"); | ||
1014 | + free (last_message); | ||
1015 | } | ||
1016 | |||
1017 | |||
1018 | + /* Check that a fatal message can safely overwrite one already stored | ||
1019 | + * in the __nih_abort_msg variable. | ||
1020 | + */ | ||
1021 | + TEST_FEATURE ("with second fatal message"); | ||
1022 | + TEST_ALLOC_FAIL { | ||
1023 | + TEST_ALLOC_SAFE { | ||
1024 | + msg = nih_strdup (NULL, "test"); | ||
1025 | + } | ||
1026 | + | ||
1027 | + __nih_abort_msg = msg; | ||
1028 | + TEST_FREE_TAG (msg); | ||
1029 | + | ||
1030 | + last_priority = NIH_LOG_UNKNOWN; | ||
1031 | + last_message = NULL; | ||
1032 | + | ||
1033 | + ret = nih_log_message (NIH_LOG_FATAL, | ||
1034 | + "message with %s %d formatting", | ||
1035 | + "some", 20); | ||
1036 | + | ||
1037 | + TEST_EQ (ret, 0); | ||
1038 | + TEST_EQ (last_priority, NIH_LOG_FATAL); | ||
1039 | + TEST_EQ_STR (last_message, "message with some 20 formatting"); | ||
1040 | + | ||
1041 | + TEST_FREE (msg); | ||
1042 | + | ||
1043 | + TEST_NE_P (__nih_abort_msg, NULL); | ||
1044 | + TEST_ALLOC_PARENT (__nih_abort_msg, NULL); | ||
1045 | + TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting"); | ||
1046 | + | ||
1047 | + free (last_message); | ||
1048 | + } | ||
1049 | + | ||
1050 | /* Check that the nih_debug macro wraps the call properly and | ||
1051 | * includes the function in which the message occurred. | ||
1052 | */ | ||
1053 | --- libnih-1.0.3.orig/nih/tests/test_hash.c | ||
1054 | +++ libnih-1.0.3/nih/tests/test_hash.c | ||
1055 | @@ -470,7 +470,8 @@ | ||
1056 | test_lookup (void) | ||
1057 | { | ||
1058 | NihHash *hash; | ||
1059 | - NihList *entry1, *entry2, *entry3, *ptr; | ||
1060 | + NihList *entry1, *entry2, *ptr; | ||
1061 | + NihList *entry3 __attribute__((unused)); | ||
1062 | |||
1063 | TEST_FUNCTION ("nih_hash_lookup"); | ||
1064 | hash = nih_hash_string_new (NULL, 0); | ||
1065 | --- libnih-1.0.3.orig/nih/tests/test_main.c | ||
1066 | +++ libnih-1.0.3/nih/tests/test_main.c | ||
1067 | @@ -457,7 +457,7 @@ | ||
1068 | test_main_loop (void) | ||
1069 | { | ||
1070 | NihMainLoopFunc *func; | ||
1071 | - NihTimer *timer; | ||
1072 | + NihTimer *timer __attribute__((unused)); | ||
1073 | int ret; | ||
1074 | |||
1075 | /* Check that we can run through the main loop, and that the | ||
1076 | --- libnih-1.0.3.orig/nih/tests/test_watch.c | ||
1077 | +++ libnih-1.0.3/nih/tests/test_watch.c | ||
1078 | @@ -2,8 +2,8 @@ | ||
1079 | * | ||
1080 | * test_watch.c - test suite for nih/watch.c | ||
1081 | * | ||
1082 | - * Copyright © 2009 Scott James Remnant <scott@netsplit.com>. | ||
1083 | - * Copyright © 2009 Canonical Ltd. | ||
1084 | + * Copyright © 2011 Scott James Remnant <scott@netsplit.com>. | ||
1085 | + * Copyright © 2011 Canonical Ltd. | ||
1086 | * | ||
1087 | * This program is free software; you can redistribute it and/or modify | ||
1088 | * it under the terms of the GNU General Public License version 2, as | ||
1089 | @@ -39,6 +39,8 @@ | ||
1090 | #include <nih/error.h> | ||
1091 | #include <nih/logging.h> | ||
1092 | |||
1093 | +/* Read "The Hitchhikers Guide to the Galaxy" */ | ||
1094 | +#define FILTER_VALUE 42 | ||
1095 | |||
1096 | static int | ||
1097 | my_filter (void *data, | ||
1098 | @@ -54,6 +56,26 @@ | ||
1099 | return FALSE; | ||
1100 | } | ||
1101 | |||
1102 | +/* Set by my_filter2 () so it knows if it has already been called */ | ||
1103 | +static int my_filter2_called = 0; | ||
1104 | + | ||
1105 | +static int | ||
1106 | +my_filter2 (int *value, | ||
1107 | + const char *path, | ||
1108 | + int is_dir) | ||
1109 | +{ | ||
1110 | + /* we only want to toggle the value once */ | ||
1111 | + if (my_filter2_called) | ||
1112 | + return TRUE; | ||
1113 | + | ||
1114 | + my_filter2_called = 1; | ||
1115 | + | ||
1116 | + nih_assert (value && *value == FILTER_VALUE); | ||
1117 | + *value = 0; | ||
1118 | + | ||
1119 | + return FALSE; | ||
1120 | +} | ||
1121 | + | ||
1122 | static int create_called = 0; | ||
1123 | static int modify_called = 0; | ||
1124 | static int delete_called = 0; | ||
1125 | @@ -553,6 +575,44 @@ | ||
1126 | nih_free (watch); | ||
1127 | } | ||
1128 | |||
1129 | + /* Ensure the file filter gets passed the correct data pointer. | ||
1130 | + */ | ||
1131 | + TEST_FEATURE ("with filter and data"); | ||
1132 | + | ||
1133 | + /* Ensure we have a new directory */ | ||
1134 | + TEST_FILENAME (dirname); | ||
1135 | + mkdir (dirname, 0755); | ||
1136 | + | ||
1137 | + /* Create a single file */ | ||
1138 | + strcpy (filename, dirname); | ||
1139 | + strcat (filename, "/foo"); | ||
1140 | + | ||
1141 | + fd = fopen (filename, "w"); | ||
1142 | + fprintf (fd, "test\n"); | ||
1143 | + fclose (fd); | ||
1144 | + | ||
1145 | + TEST_ALLOC_FAIL { | ||
1146 | + int watch_data = FILTER_VALUE; | ||
1147 | + | ||
1148 | + /* Reset required to appease TEST_ALLOC_FAIL */ | ||
1149 | + my_filter2_called = 0; | ||
1150 | + | ||
1151 | + watch = nih_watch_new (NULL, dirname, | ||
1152 | + TRUE, TRUE, | ||
1153 | + (NihFileFilter)my_filter2, | ||
1154 | + NULL, NULL, NULL, | ||
1155 | + &watch_data); | ||
1156 | + | ||
1157 | + TEST_NE_P (watch, NULL); | ||
1158 | + | ||
1159 | + /* Ensure the filter was called and changed the value */ | ||
1160 | + | ||
1161 | + TEST_NE (my_filter2_called, 0); | ||
1162 | + TEST_EQ (watch_data, 0); | ||
1163 | + | ||
1164 | + nih_free (watch); | ||
1165 | + } | ||
1166 | + | ||
1167 | strcpy (filename, dirname); | ||
1168 | strcat (filename, "/bar"); | ||
1169 | chmod (filename, 0755); | ||
1170 | @@ -946,13 +1006,82 @@ | ||
1171 | nih_error_init (); | ||
1172 | |||
1173 | TEST_FILENAME (dirname); | ||
1174 | - mkdir (dirname, 0755); | ||
1175 | + TEST_EQ (mkdir (dirname, 0755), 0); | ||
1176 | |||
1177 | - watch = nih_watch_new (NULL, dirname, TRUE, TRUE, my_filter, | ||
1178 | - my_create_handler, my_modify_handler, | ||
1179 | + TEST_FEATURE ("with watched file"); | ||
1180 | + strcpy (filename, dirname); | ||
1181 | + strcat (filename, "/foo"); | ||
1182 | + | ||
1183 | + /* Create file first since we don't set a create handler on the | ||
1184 | + * watch. | ||
1185 | + */ | ||
1186 | + fd = fopen (filename, "w"); | ||
1187 | + fprintf (fd, "bar\n"); | ||
1188 | + fclose (fd); | ||
1189 | + | ||
1190 | + create_called = 0; | ||
1191 | + modify_called = 0; | ||
1192 | + delete_called = 0; | ||
1193 | + logger_called = 0; | ||
1194 | + last_path = NULL; | ||
1195 | + last_watch = NULL; | ||
1196 | + last_data = NULL; | ||
1197 | + | ||
1198 | + watch = nih_watch_new (NULL, filename, FALSE, FALSE, NULL, | ||
1199 | + NULL, my_modify_handler, | ||
1200 | my_delete_handler, &watch); | ||
1201 | + TEST_NE_P (watch, NULL); | ||
1202 | + | ||
1203 | + /* Now, modify the existing file to trigger the modify handler. */ | ||
1204 | + fd = fopen (filename, "a+"); | ||
1205 | + fprintf (fd, "baz\n"); | ||
1206 | + fclose (fd); | ||
1207 | + | ||
1208 | + nfds = 0; | ||
1209 | + FD_ZERO (&readfds); | ||
1210 | + FD_ZERO (&writefds); | ||
1211 | + FD_ZERO (&exceptfds); | ||
1212 | + | ||
1213 | + nih_io_select_fds (&nfds, &readfds, &writefds, &exceptfds); | ||
1214 | + select (nfds, &readfds, &writefds, &exceptfds, NULL); | ||
1215 | + nih_io_handle_fds (&readfds, &writefds, &exceptfds); | ||
1216 | + | ||
1217 | + TEST_EQ_STR (watch->path, filename); | ||
1218 | + | ||
1219 | + /* Ensure no regression to old behaviour (LP:#777097) */ | ||
1220 | + TEST_NE (last_path[ strlen(last_path) - 1 ], '/'); | ||
1221 | + | ||
1222 | + TEST_EQ_STR (last_path, filename); | ||
1223 | + TEST_EQ (modify_called, 1); | ||
1224 | + | ||
1225 | + unlink (filename); | ||
1226 | + | ||
1227 | + nfds = 0; | ||
1228 | + FD_ZERO (&readfds); | ||
1229 | + FD_ZERO (&writefds); | ||
1230 | + FD_ZERO (&exceptfds); | ||
1231 | + | ||
1232 | + nih_io_select_fds (&nfds, &readfds, &writefds, &exceptfds); | ||
1233 | + select (nfds, &readfds, &writefds, &exceptfds, NULL); | ||
1234 | + nih_io_handle_fds (&readfds, &writefds, &exceptfds); | ||
1235 | |||
1236 | + TEST_EQ (delete_called, 1); | ||
1237 | |||
1238 | + rmdir (filename); | ||
1239 | + nih_free (last_path); | ||
1240 | + | ||
1241 | + create_called = 0; | ||
1242 | + modify_called = 0; | ||
1243 | + delete_called = 0; | ||
1244 | + logger_called = 0; | ||
1245 | + last_path = NULL; | ||
1246 | + last_watch = NULL; | ||
1247 | + last_data = NULL; | ||
1248 | + | ||
1249 | + | ||
1250 | + watch = nih_watch_new (NULL, dirname, TRUE, TRUE, my_filter, | ||
1251 | + my_create_handler, my_modify_handler, | ||
1252 | + my_delete_handler, &watch); | ||
1253 | /* Check that creating a file within the directory being watched | ||
1254 | * results in the create handler being called, and passed the full | ||
1255 | * path of the created file to it. | ||
1256 | --- libnih-1.0.3.orig/nih/tests/test_string.c | ||
1257 | +++ libnih-1.0.3/nih/tests/test_string.c | ||
1258 | @@ -619,6 +619,215 @@ | ||
1259 | nih_free (array); | ||
1260 | } | ||
1261 | |||
1262 | + TEST_FEATURE ("with no repeat and multiple identical delimiter " | ||
1263 | + "characters at string start"); | ||
1264 | + TEST_ALLOC_FAIL { | ||
1265 | + array = nih_str_split (NULL, "\t\tthis is a test", " \t", FALSE); | ||
1266 | + | ||
1267 | + if (test_alloc_failed) { | ||
1268 | + TEST_EQ_P (array, NULL); | ||
1269 | + continue; | ||
1270 | + } | ||
1271 | + | ||
1272 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 7); | ||
1273 | + for (i = 0; i < 6; i++) | ||
1274 | + TEST_ALLOC_PARENT (array[i], array); | ||
1275 | + | ||
1276 | + TEST_EQ_STR (array[0], ""); | ||
1277 | + TEST_EQ_STR (array[1], ""); | ||
1278 | + TEST_EQ_STR (array[2], "this"); | ||
1279 | + TEST_EQ_STR (array[3], "is"); | ||
1280 | + TEST_EQ_STR (array[4], "a"); | ||
1281 | + TEST_EQ_STR (array[5], "test"); | ||
1282 | + TEST_EQ_P (array[6], NULL); | ||
1283 | + | ||
1284 | + nih_free (array); | ||
1285 | + } | ||
1286 | + | ||
1287 | + TEST_FEATURE ("with no repeat and multiple different delimiter " | ||
1288 | + "characters at string start"); | ||
1289 | + TEST_ALLOC_FAIL { | ||
1290 | + array = nih_str_split (NULL, " \tthis is a test", " \t", FALSE); | ||
1291 | + | ||
1292 | + if (test_alloc_failed) { | ||
1293 | + TEST_EQ_P (array, NULL); | ||
1294 | + continue; | ||
1295 | + } | ||
1296 | + | ||
1297 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 7); | ||
1298 | + for (i = 0; i < 6; i++) | ||
1299 | + TEST_ALLOC_PARENT (array[i], array); | ||
1300 | + | ||
1301 | + TEST_EQ_STR (array[0], ""); | ||
1302 | + TEST_EQ_STR (array[1], ""); | ||
1303 | + TEST_EQ_STR (array[2], "this"); | ||
1304 | + TEST_EQ_STR (array[3], "is"); | ||
1305 | + TEST_EQ_STR (array[4], "a"); | ||
1306 | + TEST_EQ_STR (array[5], "test"); | ||
1307 | + TEST_EQ_P (array[6], NULL); | ||
1308 | + | ||
1309 | + nih_free (array); | ||
1310 | + } | ||
1311 | + | ||
1312 | + TEST_FEATURE ("with no repeat and multiple identical delimiter " | ||
1313 | + "characters within string"); | ||
1314 | + TEST_ALLOC_FAIL { | ||
1315 | + array = nih_str_split (NULL, "this is a\t\ttest", " \t", FALSE); | ||
1316 | + | ||
1317 | + if (test_alloc_failed) { | ||
1318 | + TEST_EQ_P (array, NULL); | ||
1319 | + continue; | ||
1320 | + } | ||
1321 | + | ||
1322 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 8); | ||
1323 | + for (i = 0; i < 7; i++) | ||
1324 | + TEST_ALLOC_PARENT (array[i], array); | ||
1325 | + | ||
1326 | + TEST_EQ_STR (array[0], "this"); | ||
1327 | + TEST_EQ_STR (array[1], "is"); | ||
1328 | + TEST_EQ_STR (array[2], ""); | ||
1329 | + TEST_EQ_STR (array[3], ""); | ||
1330 | + TEST_EQ_STR (array[4], "a"); | ||
1331 | + TEST_EQ_STR (array[5], ""); | ||
1332 | + TEST_EQ_STR (array[6], "test"); | ||
1333 | + TEST_EQ_P (array[7], NULL); | ||
1334 | + | ||
1335 | + nih_free (array); | ||
1336 | + } | ||
1337 | + | ||
1338 | + TEST_FEATURE ("with no repeat and multiple different delimiter " | ||
1339 | + "characters within string"); | ||
1340 | + TEST_ALLOC_FAIL { | ||
1341 | + array = nih_str_split (NULL, "this is \n\ta\ttest", " \t\n", FALSE); | ||
1342 | + | ||
1343 | + if (test_alloc_failed) { | ||
1344 | + TEST_EQ_P (array, NULL); | ||
1345 | + continue; | ||
1346 | + } | ||
1347 | + | ||
1348 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 7); | ||
1349 | + for (i = 0; i < 6; i++) | ||
1350 | + TEST_ALLOC_PARENT (array[i], array); | ||
1351 | + | ||
1352 | + TEST_EQ_STR (array[0], "this"); | ||
1353 | + TEST_EQ_STR (array[1], "is"); | ||
1354 | + TEST_EQ_STR (array[2], ""); | ||
1355 | + TEST_EQ_STR (array[3], ""); | ||
1356 | + TEST_EQ_STR (array[4], "a"); | ||
1357 | + TEST_EQ_STR (array[5], "test"); | ||
1358 | + TEST_EQ_P (array[6], NULL); | ||
1359 | + | ||
1360 | + nih_free (array); | ||
1361 | + } | ||
1362 | + | ||
1363 | + TEST_FEATURE ("with no repeat and multiple identical delimiter " | ||
1364 | + "characters at string end"); | ||
1365 | + TEST_ALLOC_FAIL { | ||
1366 | + array = nih_str_split (NULL, "this is a test ", " \t", FALSE); | ||
1367 | + | ||
1368 | + if (test_alloc_failed) { | ||
1369 | + TEST_EQ_P (array, NULL); | ||
1370 | + continue; | ||
1371 | + } | ||
1372 | + | ||
1373 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 6); | ||
1374 | + for (i = 0; i < 5; i++) | ||
1375 | + TEST_ALLOC_PARENT (array[i], array); | ||
1376 | + | ||
1377 | + TEST_EQ_STR (array[0], "this"); | ||
1378 | + TEST_EQ_STR (array[1], "is"); | ||
1379 | + TEST_EQ_STR (array[2], "a"); | ||
1380 | + TEST_EQ_STR (array[3], "test"); | ||
1381 | + TEST_EQ_STR (array[4], ""); | ||
1382 | + TEST_EQ_P (array[5], NULL); | ||
1383 | + | ||
1384 | + nih_free (array); | ||
1385 | + } | ||
1386 | + | ||
1387 | + TEST_FEATURE ("with no repeat and multiple different delimiter " | ||
1388 | + "characters at string end"); | ||
1389 | + TEST_ALLOC_FAIL { | ||
1390 | + array = nih_str_split (NULL, "this is a test \t", " \t", FALSE); | ||
1391 | + | ||
1392 | + if (test_alloc_failed) { | ||
1393 | + TEST_EQ_P (array, NULL); | ||
1394 | + continue; | ||
1395 | + } | ||
1396 | + | ||
1397 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 6); | ||
1398 | + for (i = 0; i < 5; i++) | ||
1399 | + TEST_ALLOC_PARENT (array[i], array); | ||
1400 | + | ||
1401 | + TEST_EQ_STR (array[0], "this"); | ||
1402 | + TEST_EQ_STR (array[1], "is"); | ||
1403 | + TEST_EQ_STR (array[2], "a"); | ||
1404 | + TEST_EQ_STR (array[3], "test"); | ||
1405 | + TEST_EQ_STR (array[4], ""); | ||
1406 | + TEST_EQ_P (array[5], NULL); | ||
1407 | + | ||
1408 | + nih_free (array); | ||
1409 | + } | ||
1410 | + | ||
1411 | + TEST_FEATURE ("with no repeat and multiple identical delimiter " | ||
1412 | + "characters at beginning, middle and end of string"); | ||
1413 | + TEST_ALLOC_FAIL { | ||
1414 | + array = nih_str_split (NULL, " this is\n\n\na test\t\t\t", " \t\n", FALSE); | ||
1415 | + | ||
1416 | + if (test_alloc_failed) { | ||
1417 | + TEST_EQ_P (array, NULL); | ||
1418 | + continue; | ||
1419 | + } | ||
1420 | + | ||
1421 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 12); | ||
1422 | + for (i = 0; i < 11; i++) | ||
1423 | + TEST_ALLOC_PARENT (array[i], array); | ||
1424 | + | ||
1425 | + TEST_EQ_STR (array[0], ""); | ||
1426 | + TEST_EQ_STR (array[1], ""); | ||
1427 | + TEST_EQ_STR (array[2], ""); | ||
1428 | + TEST_EQ_STR (array[3], "this"); | ||
1429 | + TEST_EQ_STR (array[4], "is"); | ||
1430 | + TEST_EQ_STR (array[5], ""); | ||
1431 | + TEST_EQ_STR (array[6], ""); | ||
1432 | + TEST_EQ_STR (array[7], "a"); | ||
1433 | + TEST_EQ_STR (array[8], "test"); | ||
1434 | + TEST_EQ_STR (array[9], ""); | ||
1435 | + TEST_EQ_STR (array[10], ""); | ||
1436 | + TEST_EQ_P (array[11], NULL); | ||
1437 | + | ||
1438 | + nih_free (array); | ||
1439 | + } | ||
1440 | + | ||
1441 | + TEST_FEATURE ("with no repeat and multiple different delimiter " | ||
1442 | + "characters at beginning, middle and end of string"); | ||
1443 | + TEST_ALLOC_FAIL { | ||
1444 | + array = nih_str_split (NULL, ": \nthis is\t \n:a test:\n ", "\n :\t", FALSE); | ||
1445 | + | ||
1446 | + if (test_alloc_failed) { | ||
1447 | + TEST_EQ_P (array, NULL); | ||
1448 | + continue; | ||
1449 | + } | ||
1450 | + | ||
1451 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 13); | ||
1452 | + for (i = 0; i < 12; i++) | ||
1453 | + TEST_ALLOC_PARENT (array[i], array); | ||
1454 | + | ||
1455 | + TEST_EQ_STR (array[0], ""); | ||
1456 | + TEST_EQ_STR (array[1], ""); | ||
1457 | + TEST_EQ_STR (array[2], ""); | ||
1458 | + TEST_EQ_STR (array[3], "this"); | ||
1459 | + TEST_EQ_STR (array[4], "is"); | ||
1460 | + TEST_EQ_STR (array[5], ""); | ||
1461 | + TEST_EQ_STR (array[6], ""); | ||
1462 | + TEST_EQ_STR (array[7], ""); | ||
1463 | + TEST_EQ_STR (array[8], "a"); | ||
1464 | + TEST_EQ_STR (array[9], "test"); | ||
1465 | + TEST_EQ_STR (array[10], ""); | ||
1466 | + TEST_EQ_STR (array[11], ""); | ||
1467 | + TEST_EQ_P (array[12], NULL); | ||
1468 | + | ||
1469 | + nih_free (array); | ||
1470 | + } | ||
1471 | |||
1472 | /* Check that we can split a string treating multiple consecutive | ||
1473 | * matching characters as a single separator to be skipped. | ||
1474 | @@ -645,6 +854,177 @@ | ||
1475 | nih_free (array); | ||
1476 | } | ||
1477 | |||
1478 | + /* Check that we can split a string containing multiple | ||
1479 | + * occurences of one of the delimiter characters at the | ||
1480 | + * beginning of the string. | ||
1481 | + */ | ||
1482 | + TEST_FEATURE ("with repeat and multiple identical adjacent delimiter characters at string start"); | ||
1483 | + TEST_ALLOC_FAIL { | ||
1484 | + array = nih_str_split (NULL, "\n\nhello", " \t\r\n", TRUE); | ||
1485 | + | ||
1486 | + if (test_alloc_failed) { | ||
1487 | + TEST_EQ_P (array, NULL); | ||
1488 | + continue; | ||
1489 | + } | ||
1490 | + | ||
1491 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 2); | ||
1492 | + for (i = 0; i < 1; i++) | ||
1493 | + TEST_ALLOC_PARENT (array[i], array); | ||
1494 | + | ||
1495 | + TEST_EQ_STR (array[0], "hello"); | ||
1496 | + TEST_EQ_P (array[1], NULL); | ||
1497 | + | ||
1498 | + nih_free (array); | ||
1499 | + } | ||
1500 | + | ||
1501 | + TEST_FEATURE ("with repeat and multiple different adjacent delimiter characters at string start"); | ||
1502 | + TEST_ALLOC_FAIL { | ||
1503 | + array = nih_str_split (NULL, "\n\r hello", " \t\r\n", TRUE); | ||
1504 | + | ||
1505 | + if (test_alloc_failed) { | ||
1506 | + TEST_EQ_P (array, NULL); | ||
1507 | + continue; | ||
1508 | + } | ||
1509 | + | ||
1510 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 2); | ||
1511 | + for (i = 0; i < 1; i++) | ||
1512 | + TEST_ALLOC_PARENT (array[i], array); | ||
1513 | + | ||
1514 | + TEST_EQ_STR (array[0], "hello"); | ||
1515 | + TEST_EQ_P (array[1], NULL); | ||
1516 | + | ||
1517 | + nih_free (array); | ||
1518 | + } | ||
1519 | + | ||
1520 | + TEST_FEATURE ("with repeat and multiple identical adjacent delimiter " | ||
1521 | + "characters within string"); | ||
1522 | + TEST_ALLOC_FAIL { | ||
1523 | + array = nih_str_split (NULL, "hello\n\rworld", " \t\n\r", TRUE); | ||
1524 | + | ||
1525 | + if (test_alloc_failed) { | ||
1526 | + TEST_EQ_P (array, NULL); | ||
1527 | + continue; | ||
1528 | + } | ||
1529 | + | ||
1530 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 3); | ||
1531 | + for (i = 0; i < 2; i++) | ||
1532 | + TEST_ALLOC_PARENT (array[i], array); | ||
1533 | + | ||
1534 | + TEST_EQ_STR (array[0], "hello"); | ||
1535 | + TEST_EQ_STR (array[1], "world"); | ||
1536 | + TEST_EQ_P (array[2], NULL); | ||
1537 | + | ||
1538 | + nih_free (array); | ||
1539 | + } | ||
1540 | + | ||
1541 | + TEST_FEATURE ("with repeat and multiple different adjacent delimiter " | ||
1542 | + "characters within string"); | ||
1543 | + TEST_ALLOC_FAIL { | ||
1544 | + array = nih_str_split (NULL, "hello\n\r\tworld", " \t\n\r", TRUE); | ||
1545 | + | ||
1546 | + if (test_alloc_failed) { | ||
1547 | + TEST_EQ_P (array, NULL); | ||
1548 | + continue; | ||
1549 | + } | ||
1550 | + | ||
1551 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 3); | ||
1552 | + for (i = 0; i < 2; i++) | ||
1553 | + TEST_ALLOC_PARENT (array[i], array); | ||
1554 | + | ||
1555 | + TEST_EQ_STR (array[0], "hello"); | ||
1556 | + TEST_EQ_STR (array[1], "world"); | ||
1557 | + TEST_EQ_P (array[2], NULL); | ||
1558 | + | ||
1559 | + nih_free (array); | ||
1560 | + } | ||
1561 | + | ||
1562 | + TEST_FEATURE ("with repeat and multiple identical adjacent delimiter " | ||
1563 | + "characters at string end"); | ||
1564 | + TEST_ALLOC_FAIL { | ||
1565 | + array = nih_str_split (NULL, "hello\n\n\n\n\n\n\n", " \t\r\n", TRUE); | ||
1566 | + | ||
1567 | + if (test_alloc_failed) { | ||
1568 | + TEST_EQ_P (array, NULL); | ||
1569 | + continue; | ||
1570 | + } | ||
1571 | + | ||
1572 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 2); | ||
1573 | + for (i = 0; i < 1; i++) | ||
1574 | + TEST_ALLOC_PARENT (array[i], array); | ||
1575 | + | ||
1576 | + TEST_EQ_STR (array[0], "hello"); | ||
1577 | + TEST_EQ_P (array[1], NULL); | ||
1578 | + | ||
1579 | + nih_free (array); | ||
1580 | + } | ||
1581 | + | ||
1582 | + TEST_FEATURE ("with repeat and multiple different adjacent delimiter " | ||
1583 | + "characters at string end"); | ||
1584 | + TEST_ALLOC_FAIL { | ||
1585 | + array = nih_str_split (NULL, "hello \r\t\r\t\n ", " \t\r\n", TRUE); | ||
1586 | + | ||
1587 | + if (test_alloc_failed) { | ||
1588 | + TEST_EQ_P (array, NULL); | ||
1589 | + continue; | ||
1590 | + } | ||
1591 | + | ||
1592 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 2); | ||
1593 | + for (i = 0; i < 1; i++) | ||
1594 | + TEST_ALLOC_PARENT (array[i], array); | ||
1595 | + | ||
1596 | + TEST_EQ_STR (array[0], "hello"); | ||
1597 | + TEST_EQ_P (array[1], NULL); | ||
1598 | + | ||
1599 | + nih_free (array); | ||
1600 | + } | ||
1601 | + | ||
1602 | + TEST_FEATURE ("with repeat and multiple identical adjacent delimiter " | ||
1603 | + "characters at beginning, middle and end of string"); | ||
1604 | + TEST_ALLOC_FAIL { | ||
1605 | + array = nih_str_split (NULL, | ||
1606 | + " hello\n\n\n, world\n\n\n", | ||
1607 | + "\r\t\n ", TRUE); | ||
1608 | + | ||
1609 | + if (test_alloc_failed) { | ||
1610 | + TEST_EQ_P (array, NULL); | ||
1611 | + continue; | ||
1612 | + } | ||
1613 | + | ||
1614 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 4); | ||
1615 | + for (i = 0; i < 3; i++) | ||
1616 | + TEST_ALLOC_PARENT (array[i], array); | ||
1617 | + | ||
1618 | + TEST_EQ_STR (array[0], "hello"); | ||
1619 | + TEST_EQ_STR (array[1], ","); | ||
1620 | + TEST_EQ_STR (array[2], "world"); | ||
1621 | + TEST_EQ_P (array[3], NULL); | ||
1622 | + | ||
1623 | + nih_free (array); | ||
1624 | + } | ||
1625 | + | ||
1626 | + TEST_FEATURE ("with repeat and multiple different adjacent delimiter " | ||
1627 | + "characters at beginning, middle and end of string"); | ||
1628 | + TEST_ALLOC_FAIL { | ||
1629 | + array = nih_str_split (NULL, | ||
1630 | + "\n \r\thello\n\n\r , \n\t\rworld\t \r\n \n", | ||
1631 | + " \t\n\r", TRUE); | ||
1632 | + | ||
1633 | + if (test_alloc_failed) { | ||
1634 | + TEST_EQ_P (array, NULL); | ||
1635 | + continue; | ||
1636 | + } | ||
1637 | + | ||
1638 | + TEST_ALLOC_SIZE (array, sizeof (char *) * 4); | ||
1639 | + for (i = 0; i < 3; i++) | ||
1640 | + TEST_ALLOC_PARENT (array[i], array); | ||
1641 | + | ||
1642 | + TEST_EQ_STR (array[0], "hello"); | ||
1643 | + TEST_EQ_STR (array[1], ","); | ||
1644 | + TEST_EQ_STR (array[2], "world"); | ||
1645 | + TEST_EQ_P (array[3], NULL); | ||
1646 | + | ||
1647 | + nih_free (array); | ||
1648 | + } | ||
1649 | |||
1650 | /* Check that we can give an empty string, and end up with a | ||
1651 | * one-element array that only contains a NULL pointer. | ||
1652 | --- libnih-1.0.3.orig/nih/tests/test_file.c | ||
1653 | +++ libnih-1.0.3/nih/tests/test_file.c | ||
1654 | @@ -724,6 +724,25 @@ | ||
1655 | return FALSE; | ||
1656 | } | ||
1657 | |||
1658 | +/* find only frodo files */ | ||
1659 | +static int | ||
1660 | +my_filter_frodo_file (void *data, | ||
1661 | + const char *path, | ||
1662 | + int is_dir) | ||
1663 | +{ | ||
1664 | + char *slash; | ||
1665 | + | ||
1666 | + if (is_dir) | ||
1667 | + return FALSE; | ||
1668 | + | ||
1669 | + slash = strrchr (path, '/'); | ||
1670 | + if (strcmp (slash, "/frodo")) | ||
1671 | + return TRUE; | ||
1672 | + | ||
1673 | + return FALSE; | ||
1674 | +} | ||
1675 | + | ||
1676 | + | ||
1677 | static int logger_called = 0; | ||
1678 | |||
1679 | static int | ||
1680 | @@ -905,6 +924,48 @@ | ||
1681 | TEST_EQ_STR (v->path, filename); | ||
1682 | |||
1683 | nih_free (visited); | ||
1684 | + | ||
1685 | + /* Try also inverse filter */ | ||
1686 | + TEST_ALLOC_SAFE { | ||
1687 | + visitor_called = 0; | ||
1688 | + visited = nih_list_new (NULL); | ||
1689 | + } | ||
1690 | + | ||
1691 | + ret = nih_dir_walk (dirname, my_filter_frodo_file, | ||
1692 | + my_visitor, NULL, &ret); | ||
1693 | + | ||
1694 | + TEST_EQ (ret, 0); | ||
1695 | + TEST_EQ (visitor_called, 4); | ||
1696 | + | ||
1697 | + v = (Visited *)visited->next; | ||
1698 | + TEST_EQ (v->data, &ret); | ||
1699 | + TEST_EQ_STR (v->dirname, dirname); | ||
1700 | + strcpy (filename, dirname); | ||
1701 | + strcat (filename, "/bar"); | ||
1702 | + TEST_EQ_STR (v->path, filename); | ||
1703 | + | ||
1704 | + v = (Visited *)v->entry.next; | ||
1705 | + TEST_EQ (v->data, &ret); | ||
1706 | + TEST_EQ_STR (v->dirname, dirname); | ||
1707 | + strcpy (filename, dirname); | ||
1708 | + strcat (filename, "/bar/frodo"); | ||
1709 | + TEST_EQ_STR (v->path, filename); | ||
1710 | + | ||
1711 | + v = (Visited *)v->entry.next; | ||
1712 | + TEST_EQ (v->data, &ret); | ||
1713 | + TEST_EQ_STR (v->dirname, dirname); | ||
1714 | + strcpy (filename, dirname); | ||
1715 | + strcat (filename, "/baz"); | ||
1716 | + TEST_EQ_STR (v->path, filename); | ||
1717 | + | ||
1718 | + v = (Visited *)v->entry.next; | ||
1719 | + TEST_EQ (v->data, &ret); | ||
1720 | + TEST_EQ_STR (v->dirname, dirname); | ||
1721 | + strcpy (filename, dirname); | ||
1722 | + strcat (filename, "/frodo"); | ||
1723 | + TEST_EQ_STR (v->path, filename); | ||
1724 | + | ||
1725 | + nih_free (visited); | ||
1726 | } | ||
1727 | |||
1728 | |||
1729 | --- libnih-1.0.3.orig/debian/control | ||
1730 | +++ libnih-1.0.3/debian/control | ||
1731 | @@ -0,0 +1,81 @@ | ||
1732 | +Source: libnih | ||
1733 | +Section: libs | ||
1734 | +Priority: required | ||
1735 | +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | ||
1736 | +XSBC-Original-Maintainer: Scott James Remnant <scott@netsplit.com> | ||
1737 | +Standards-Version: 3.9.4 | ||
1738 | +Build-Depends: debhelper (>= 9), pkg-config (>= 0.22), libdbus-1-dev (>= 1.4), libexpat1-dev (>= 2.0.0), dbus (>= 1.4), libc6-dev (>= 2.15~) | libc6.1-dev (>= 2.15~), | ||
1739 | + dh-autoreconf, autopoint, dpkg-dev (>= 1.16.1~) | ||
1740 | +# To cross build this package also needs: libdbus-1-dev:native (>= 1.4), libexpat1-dev:native (>= 2.0.0) | ||
1741 | +# But :native build-deps are not supported yet, so instead one can do | ||
1742 | +# $ apt-get build-dep libnih | ||
1743 | +# $ apt-get build-dep libnih -aarmhf | ||
1744 | +# instead to get all required build-deps | ||
1745 | +Vcs-Bzr: lp:ubuntu/libnih | ||
1746 | +XSC-Debian-Vcs-Git: git://git.debian.org/git/collab-maint/libnih.git | ||
1747 | +XSC-Debian-Vcs-Browser: http://git.debian.org/?p=collab-maint/libnih.git;a=summary | ||
1748 | +Homepage: https://launchpad.net/libnih | ||
1749 | + | ||
1750 | +Package: libnih1 | ||
1751 | +Architecture: any | ||
1752 | +Pre-Depends: ${misc:Pre-Depends}, ${shlibs:Depends}, ${misc:Depends} | ||
1753 | +Multi-Arch: same | ||
1754 | +Description: NIH Utility Library | ||
1755 | + libnih is a light-weight "standard library" of C functions to ease the | ||
1756 | + development of other libraries and applications, especially those | ||
1757 | + normally found in /lib. | ||
1758 | + . | ||
1759 | + This package contains the shared library. | ||
1760 | + | ||
1761 | +Package: libnih-dev | ||
1762 | +Priority: optional | ||
1763 | +Section: libdevel | ||
1764 | +Architecture: any | ||
1765 | +Multi-Arch: same | ||
1766 | +Depends: libnih1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} | ||
1767 | +Description: NIH Utility Library (development files) | ||
1768 | + libnih is a light-weight "standard library" of C functions to ease the | ||
1769 | + development of other libraries and applications, especially those | ||
1770 | + normally found in /lib. | ||
1771 | + . | ||
1772 | + This package contains the static library and C header files which are | ||
1773 | + needed for developing software using libnih. | ||
1774 | + | ||
1775 | +Package: libnih-dbus1 | ||
1776 | +Architecture: any | ||
1777 | +Pre-Depends: ${misc:Pre-Depends} | ||
1778 | +Depends: libnih1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} | ||
1779 | +Multi-Arch: same | ||
1780 | +Description: NIH D-Bus Bindings Library | ||
1781 | + libnih-dbus is a D-Bus bindings library that integrates with the main | ||
1782 | + loop provided by libnih. | ||
1783 | + . | ||
1784 | + This package contains the shared library. | ||
1785 | + | ||
1786 | +Package: libnih-dbus-dev | ||
1787 | +Priority: optional | ||
1788 | +Section: libdevel | ||
1789 | +Architecture: any | ||
1790 | +Multi-Arch: same | ||
1791 | +Depends: libnih-dbus1 (= ${binary:Version}), libnih-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} | ||
1792 | +Recommends: nih-dbus-tool (= ${binary:Version}) | ||
1793 | +Description: NIH D-Bus Bindings Library (development files) | ||
1794 | + libnih-dbus is a D-Bus bindings library that integrates with the main | ||
1795 | + loop provided by libnih. | ||
1796 | + . | ||
1797 | + This package contains the static library and C header files which are | ||
1798 | + needed for developing software using libnih-dbus. | ||
1799 | + | ||
1800 | +Package: nih-dbus-tool | ||
1801 | +Section: devel | ||
1802 | +Architecture: any | ||
1803 | +Multi-Arch: foreign | ||
1804 | +Depends: ${shlibs:Depends}, ${misc:Depends} | ||
1805 | +Recommends: libnih-dbus-dev (= ${binary:Version}) | ||
1806 | +Description: NIH D-Bus Binding Tool | ||
1807 | + nih-dbus-tool generates C source code from the D-Bus Introspection XML | ||
1808 | + data provided by most services; either to make implementing the | ||
1809 | + described objects in C programs or to make proxying to the described | ||
1810 | + remote objects easier. | ||
1811 | + . | ||
1812 | + The generated code requires libnih-dbus-dev to be compiled. | ||
1813 | --- libnih-1.0.3.orig/debian/libnih-dev.install | ||
1814 | +++ libnih-1.0.3/debian/libnih-dev.install | ||
1815 | @@ -0,0 +1,6 @@ | ||
1816 | +lib/*/libnih.a | ||
1817 | +lib/*/libnih.so | ||
1818 | +usr/include/libnih.h | ||
1819 | +usr/include/nih | ||
1820 | +usr/lib/*/pkgconfig/libnih.pc | ||
1821 | +usr/share/aclocal/libnih.m4 | ||
1822 | --- libnih-1.0.3.orig/debian/libnih1.docs | ||
1823 | +++ libnih-1.0.3/debian/libnih1.docs | ||
1824 | @@ -0,0 +1,3 @@ | ||
1825 | +AUTHORS | ||
1826 | +NEWS | ||
1827 | +README | ||
1828 | --- libnih-1.0.3.orig/debian/libnih-dbus1.install | ||
1829 | +++ libnih-1.0.3/debian/libnih-dbus1.install | ||
1830 | @@ -0,0 +1 @@ | ||
1831 | +lib/*/libnih-dbus.so.* | ||
1832 | --- libnih-1.0.3.orig/debian/libnih1.install | ||
1833 | +++ libnih-1.0.3/debian/libnih1.install | ||
1834 | @@ -0,0 +1 @@ | ||
1835 | +lib/*/libnih.so.* | ||
1836 | --- libnih-1.0.3.orig/debian/rules | ||
1837 | +++ libnih-1.0.3/debian/rules | ||
1838 | @@ -0,0 +1,54 @@ | ||
1839 | +#!/usr/bin/make -f | ||
1840 | + | ||
1841 | +include /usr/share/dpkg/architecture.mk | ||
1842 | + | ||
1843 | +%: | ||
1844 | + dh $@ --with autoreconf | ||
1845 | + | ||
1846 | + | ||
1847 | +CFLAGS := -Wall -fstack-protector -fPIE $(shell dpkg-buildflags --get CFLAGS) | ||
1848 | +LDFLAGS := -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie $(shell dpkg-buildflags --get LDFLAGS) | ||
1849 | + | ||
1850 | +override_dh_auto_configure: | ||
1851 | +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) | ||
1852 | + dh_auto_configure -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ | ||
1853 | + --libdir=/lib/$(DEB_HOST_MULTIARCH) | ||
1854 | +else | ||
1855 | + dh_auto_configure -B build-dbus-tool/ -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ | ||
1856 | + --libdir=/lib/$(DEB_BUILD_MULTIARCH) \ | ||
1857 | + --host=$(DEB_BUILD_GNU_TYPE) | ||
1858 | + dh_auto_build -B build-dbus-tool/ --parallel | ||
1859 | + dh_auto_configure -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ | ||
1860 | + NIH_DBUS_TOOL=$(CURDIR)/build-dbus-tool/nih-dbus-tool/nih-dbus-tool \ | ||
1861 | + --libdir=/lib/$(DEB_HOST_MULTIARCH) | ||
1862 | +endif | ||
1863 | + | ||
1864 | +override_dh_auto_build: | ||
1865 | + dh_auto_build --parallel | ||
1866 | + | ||
1867 | +override_dh_auto_test: | ||
1868 | +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) | ||
1869 | + dh_auto_test --parallel | ||
1870 | +endif | ||
1871 | + | ||
1872 | +override_dh_auto_install: | ||
1873 | + dh_auto_install -- pkgconfigdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/pkgconfig | ||
1874 | + | ||
1875 | +override_dh_makeshlibs: | ||
1876 | + dh_makeshlibs -plibnih1 -V 'libnih1 (>= 1.0.0)' | ||
1877 | + dh_makeshlibs -plibnih-dbus1 -V 'libnih-dbus1 (>= 1.0.0)' | ||
1878 | + dh_makeshlibs -Nlibnih1 -Nlibnih-dbus1 | ||
1879 | + | ||
1880 | +override_dh_shlibdeps: | ||
1881 | + dh_shlibdeps | ||
1882 | + sed -i 's/2\.14/2.15/' debian/*.substvars | ||
1883 | + sed -i 's/>= 2.15)/>= 2.15~)/g' debian/*.substvars | ||
1884 | + | ||
1885 | + | ||
1886 | +# Symlink /usr/share/doc directories together | ||
1887 | +override_dh_installdocs: | ||
1888 | + dh_installdocs --link-doc=libnih1 | ||
1889 | + | ||
1890 | +override_dh_clean: | ||
1891 | + rm -rf build-dbus-tool/ | ||
1892 | + dh_clean | ||
1893 | --- libnih-1.0.3.orig/debian/compat | ||
1894 | +++ libnih-1.0.3/debian/compat | ||
1895 | @@ -0,0 +1 @@ | ||
1896 | +9 | ||
1897 | --- libnih-1.0.3.orig/debian/nih-dbus-tool.install | ||
1898 | +++ libnih-1.0.3/debian/nih-dbus-tool.install | ||
1899 | @@ -0,0 +1,2 @@ | ||
1900 | +usr/bin/nih-dbus-tool | ||
1901 | +usr/share/man/man1/nih-dbus-tool.1 | ||
1902 | --- libnih-1.0.3.orig/debian/copyright | ||
1903 | +++ libnih-1.0.3/debian/copyright | ||
1904 | @@ -0,0 +1,18 @@ | ||
1905 | +This is the Ubuntu package of libnih, the NIH Utility Library. | ||
1906 | + | ||
1907 | +Copyright © 2009 Canonical Ltd. | ||
1908 | +Copyright © 2009 Scott James Remnant <scott@netsplit.com> | ||
1909 | + | ||
1910 | +Licence: | ||
1911 | + | ||
1912 | +This program is free software; you can redistribute it and/or modify | ||
1913 | +it under the terms of the GNU General Public License version 2, as | ||
1914 | +published by the Free Software Foundation. | ||
1915 | + | ||
1916 | +This program is distributed in the hope that it will be useful, but | ||
1917 | +WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1918 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1919 | +General Public License for more details. | ||
1920 | + | ||
1921 | +On Ubuntu systems, the complete text of the GNU General Public License | ||
1922 | +can be found in ‘/usr/share/common-licenses/GPL-2’. | ||
1923 | --- libnih-1.0.3.orig/debian/libnih-dbus1.postinst | ||
1924 | +++ libnih-1.0.3/debian/libnih-dbus1.postinst | ||
1925 | @@ -0,0 +1,53 @@ | ||
1926 | +#!/bin/sh | ||
1927 | + | ||
1928 | +set -e | ||
1929 | + | ||
1930 | +if [ "$1" = configure ]; then | ||
1931 | + # A dependent library of Upstart has changed, so restart Upstart | ||
1932 | + # such that it can safely unmount the root filesystem (LP: #740390) | ||
1933 | + | ||
1934 | + # Query running version of Upstart, but only when we know | ||
1935 | + # that initctl will work. | ||
1936 | + # | ||
1937 | + # The calculated version string may be the null string if | ||
1938 | + # Upstart is not running (where for example an alternative | ||
1939 | + # init is running outside a chroot environment) or if the | ||
1940 | + # query failed for some reason. However, the version check | ||
1941 | + # below handles a null version string correctly. | ||
1942 | + UPSTART_VERSION_RUNNING=$(initctl version 2>/dev/null |\ | ||
1943 | + awk '{print $3}'|tr -d ')' || :) | ||
1944 | + | ||
1945 | + if ischroot; then | ||
1946 | + # Do not honour re-exec when requested from within a | ||
1947 | + # chroot since: | ||
1948 | + # | ||
1949 | + # (a) The version of Upstart outside might not support it. | ||
1950 | + # (b) An isolated environment such as a chroot should | ||
1951 | + # not be able to modify its containing environment. | ||
1952 | + # | ||
1953 | + # A sufficiently new Upstart will actually handle a re-exec | ||
1954 | + # request coming from telinit within a chroot correctly (by | ||
1955 | + # doing nothing) but it's simple enough to perform the check | ||
1956 | + # here and save Upstart the effort. | ||
1957 | + : | ||
1958 | + elif dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 1.6.1; then | ||
1959 | + # We are not running inside a chroot and the running version | ||
1960 | + # of Upstart supports stateful re-exec, so we can | ||
1961 | + # restart immediately. | ||
1962 | + # | ||
1963 | + # XXX: Note that the check on the running version must | ||
1964 | + # remain *indefinitely* since it's the only safe way to | ||
1965 | + # know if stateful re-exec is supported: simply checking | ||
1966 | + # packaged version numbers is not sufficient since | ||
1967 | + # the package could be upgraded multiple times without a | ||
1968 | + # reboot. | ||
1969 | + telinit u || : | ||
1970 | + else | ||
1971 | + # Before we shutdown or reboot, we need to re-exec so that we | ||
1972 | + # can safely remount the root filesystem; we can't just do that | ||
1973 | + # here because we lose state. | ||
1974 | + touch /var/run/init.upgraded || : | ||
1975 | + fi | ||
1976 | +fi | ||
1977 | + | ||
1978 | +#DEBHELPER# | ||
1979 | --- libnih-1.0.3.orig/debian/changelog.DEBIAN | ||
1980 | +++ libnih-1.0.3/debian/changelog.DEBIAN | ||
1981 | @@ -0,0 +1,118 @@ | ||
1982 | +libnih (1.0.3-4) unstable; urgency=low | ||
1983 | + | ||
1984 | + * Rebuild for new libc to update versioned dependency; this comes from | ||
1985 | + the __abort_msg dependency, dpkg-shlibs needs overriding since this is | ||
1986 | + actually a weak link, but this rebuild fixes things for now. | ||
1987 | + Closes: #625257. | ||
1988 | + | ||
1989 | + -- Scott James Remnant <scott@netsplit.com> Mon, 02 May 2011 15:08:33 -0700 | ||
1990 | + | ||
1991 | +libnih (1.0.3-3) unstable; urgency=low | ||
1992 | + | ||
1993 | + * New maintainer. Closes: #624442. | ||
1994 | + | ||
1995 | + -- Scott James Remnant <scott@netsplit.com> Thu, 28 Apr 2011 14:26:05 -0700 | ||
1996 | + | ||
1997 | +libnih (1.0.3-2) unstable; urgency=low | ||
1998 | + | ||
1999 | + * Bump build dependency on libdbus-1-dev and dbus to (>= 1.4) for Unix file | ||
2000 | + descriptor passing support. | ||
2001 | + | ||
2002 | + -- Michael Biebl <biebl@debian.org> Thu, 10 Feb 2011 20:25:18 +0100 | ||
2003 | + | ||
2004 | +libnih (1.0.3-1ubuntu1) natty; urgency=low | ||
2005 | + | ||
2006 | + * Rebuild with libc6-dev (>= 2.13~). | ||
2007 | + | ||
2008 | + -- Matthias Klose <doko@ubuntu.com> Fri, 18 Feb 2011 12:09:29 +0100 | ||
2009 | + | ||
2010 | +libnih (1.0.3-1) unstable; urgency=low | ||
2011 | + | ||
2012 | + * New upstream release. | ||
2013 | + * Bump debhelper compatibility level to 8 and update build dependency | ||
2014 | + accordingly. | ||
2015 | + | ||
2016 | + -- Michael Biebl <biebl@debian.org> Mon, 07 Feb 2011 22:19:13 +0100 | ||
2017 | + | ||
2018 | +libnih (1.0.2-2) unstable; urgency=low | ||
2019 | + | ||
2020 | + * Install library development files to /usr/lib and not /lib. | ||
2021 | + * Remove libtool *.la files as there are no reverse dependencies referencing | ||
2022 | + them. | ||
2023 | + * Bump Standards-Version to 3.9.1. No further changes. | ||
2024 | + | ||
2025 | + -- Michael Biebl <biebl@debian.org> Sun, 02 Jan 2011 21:09:40 +0100 | ||
2026 | + | ||
2027 | +libnih (1.0.2-1ubuntu3) natty; urgency=low | ||
2028 | + | ||
2029 | + * Disable some tests on ppc64 to build an initial package. | ||
2030 | + | ||
2031 | + -- Matthias Klose <doko@ubuntu.com> Thu, 18 Nov 2010 10:59:38 +0100 | ||
2032 | + | ||
2033 | +libnih (1.0.2-1ubuntu2) maverick; urgency=low | ||
2034 | + | ||
2035 | + * Re-add -fPIE to the testsuite on armel, removing all armel-specific tests; | ||
2036 | + current gcc-4.4 don't seem affected by the ICE anymore (see LP #398403). | ||
2037 | + | ||
2038 | + -- Loïc Minier <loic.minier@linaro.org> Mon, 23 Aug 2010 10:25:31 +0200 | ||
2039 | + | ||
2040 | +libnih (1.0.2-1ubuntu1) maverick; urgency=low | ||
2041 | + | ||
2042 | + * Rebuild with libc6-dev (>= 2.12~), after checking that | ||
2043 | + __abort_msg is available with the same signature in eglibc 2.12. | ||
2044 | + * Don't build the testsuite with -fPIE on armel; LP: #398403. | ||
2045 | + | ||
2046 | + -- Matthias Klose <doko@ubuntu.com> Sun, 30 May 2010 02:54:56 +0200 | ||
2047 | + | ||
2048 | +libnih (1.0.2-1) unstable; urgency=low | ||
2049 | + | ||
2050 | + * Initial upload to Debian. Closes: #585071 | ||
2051 | + * Based on the Ubuntu package for Lucid done by Scott James Remnant with the | ||
2052 | + following changes: | ||
2053 | + - Switch packages to priority optional. | ||
2054 | + - Use binary:Version instead of Source-Version. | ||
2055 | + - Bump Standards-Version to 3.8.4. | ||
2056 | + - Add Homepage and Vcs-* fields. | ||
2057 | + - Don't symlink /usr/share/doc directories. | ||
2058 | + - Refer to versioned /usr/share/common-licenses/GPL-2 file in | ||
2059 | + debian/copyright. | ||
2060 | + - List all symbols explicitly instead of using a wildcard and add symbols | ||
2061 | + introduced in 1.0.1. | ||
2062 | + - Use the symbols files to create the correct version info instead of | ||
2063 | + specifying it manually via shlibs. | ||
2064 | + - Switch to source format 3.0 (quilt). | ||
2065 | + - Add watch file to track new upstream releases. | ||
2066 | + | ||
2067 | + -- Michael Biebl <biebl@debian.org> Sun, 13 Jun 2010 23:36:52 +0200 | ||
2068 | + | ||
2069 | +libnih (1.0.1-1) lucid; urgency=low | ||
2070 | + | ||
2071 | + * New upstream release: | ||
2072 | + - Add missing __nih_* symbols to linker version script so that we | ||
2073 | + can link Upstart's test suite. | ||
2074 | + - Glibc __abort_msg symbol now only linked as a weak symbol. | ||
2075 | + | ||
2076 | + -- Scott James Remnant <scott@ubuntu.com> Thu, 04 Feb 2010 14:53:26 -0800 | ||
2077 | + | ||
2078 | +libnih (1.0.0-2build1) lucid; urgency=low | ||
2079 | + | ||
2080 | + * Rebuild to pick up relaxed dependency on libc6, after checking that | ||
2081 | + __abort_msg is available with the same signature in eglibc 2.11. | ||
2082 | + LP: #508702. | ||
2083 | + | ||
2084 | + -- Matthias Klose <doko@ubuntu.com> Mon, 18 Jan 2010 16:09:13 +0100 | ||
2085 | + | ||
2086 | +libnih (1.0.0-2) lucid; urgency=low | ||
2087 | + | ||
2088 | + * debian/control: Add build-dependency on dbus so the test suite can | ||
2089 | + pass on the buildds. | ||
2090 | + | ||
2091 | + -- Scott James Remnant <scott@ubuntu.com> Sat, 28 Nov 2009 23:28:27 +0000 | ||
2092 | + | ||
2093 | +libnih (1.0.0-1) lucid; urgency=low | ||
2094 | + | ||
2095 | + * First upstream release. Previously this code was included in the | ||
2096 | + upstart, mountall and ureadahead source packages. | ||
2097 | + | ||
2098 | + -- Scott James Remnant <scott@ubuntu.com> Sat, 28 Nov 2009 21:14:00 +0000 | ||
2099 | + | ||
2100 | --- libnih-1.0.3.orig/debian/libnih1.symbols | ||
2101 | +++ libnih-1.0.3/debian/libnih1.symbols | ||
2102 | @@ -0,0 +1,2 @@ | ||
2103 | +libnih.so.1 libnih1 #MINVER# | ||
2104 | + *@LIBNIH_1_0 1.0.0 | ||
2105 | --- libnih-1.0.3.orig/debian/libnih-dbus-dev.install | ||
2106 | +++ libnih-1.0.3/debian/libnih-dbus-dev.install | ||
2107 | @@ -0,0 +1,5 @@ | ||
2108 | +lib/*/libnih-dbus.a | ||
2109 | +lib/*/libnih-dbus.so | ||
2110 | +usr/include/libnih-dbus.h | ||
2111 | +usr/include/nih-dbus | ||
2112 | +usr/lib/*/pkgconfig/libnih-dbus.pc | ||
2113 | --- libnih-1.0.3.orig/debian/libnih1.postinst | ||
2114 | +++ libnih-1.0.3/debian/libnih1.postinst | ||
2115 | @@ -0,0 +1,53 @@ | ||
2116 | +#!/bin/sh | ||
2117 | + | ||
2118 | +set -e | ||
2119 | + | ||
2120 | +if [ "$1" = configure ]; then | ||
2121 | + # A dependent library of Upstart has changed, so restart Upstart | ||
2122 | + # such that it can safely unmount the root filesystem (LP: #740390) | ||
2123 | + | ||
2124 | + # Query running version of Upstart, but only when we know | ||
2125 | + # that initctl will work. | ||
2126 | + # | ||
2127 | + # The calculated version string may be the null string if | ||
2128 | + # Upstart is not running (where for example an alternative | ||
2129 | + # init is running outside a chroot environment) or if the | ||
2130 | + # query failed for some reason. However, the version check | ||
2131 | + # below handles a null version string correctly. | ||
2132 | + UPSTART_VERSION_RUNNING=$(initctl version 2>/dev/null |\ | ||
2133 | + awk '{print $3}'|tr -d ')' || :) | ||
2134 | + | ||
2135 | + if ischroot; then | ||
2136 | + # Do not honour re-exec when requested from within a | ||
2137 | + # chroot since: | ||
2138 | + # | ||
2139 | + # (a) The version of Upstart outside might not support it. | ||
2140 | + # (b) An isolated environment such as a chroot should | ||
2141 | + # not be able to modify its containing environment. | ||
2142 | + # | ||
2143 | + # A sufficiently new Upstart will actually handle a re-exec | ||
2144 | + # request coming from telinit within a chroot correctly (by | ||
2145 | + # doing nothing) but it's simple enough to perform the check | ||
2146 | + # here and save Upstart the effort. | ||
2147 | + : | ||
2148 | + elif dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 1.6.1; then | ||
2149 | + # We are not running inside a chroot and the running version | ||
2150 | + # of Upstart supports stateful re-exec, so we can | ||
2151 | + # restart immediately. | ||
2152 | + # | ||
2153 | + # XXX: Note that the check on the running version must | ||
2154 | + # remain *indefinitely* since it's the only safe way to | ||
2155 | + # know if stateful re-exec is supported: simply checking | ||
2156 | + # packaged version numbers is not sufficient since | ||
2157 | + # the package could be upgraded multiple times without a | ||
2158 | + # reboot. | ||
2159 | + telinit u || : | ||
2160 | + else | ||
2161 | + # Before we shutdown or reboot, we need to re-exec so that we | ||
2162 | + # can safely remount the root filesystem; we can't just do that | ||
2163 | + # here because we lose state. | ||
2164 | + touch /var/run/init.upgraded || : | ||
2165 | + fi | ||
2166 | +fi | ||
2167 | + | ||
2168 | +#DEBHELPER# | ||
2169 | --- libnih-1.0.3.orig/debian/libnih-dbus1.symbols | ||
2170 | +++ libnih-1.0.3/debian/libnih-dbus1.symbols | ||
2171 | @@ -0,0 +1,2 @@ | ||
2172 | +libnih-dbus.so.1 libnih-dbus1 #MINVER# | ||
2173 | + *@LIBNIH_DBUS_1_0 1.0.0 | ||
2174 | --- libnih-1.0.3.orig/debian/changelog | ||
2175 | +++ libnih-1.0.3/debian/changelog | ||
2176 | @@ -0,0 +1,213 @@ | ||
2177 | +libnih (1.0.3-4ubuntu16) raring; urgency=low | ||
2178 | + | ||
2179 | + * debian/{libnih1.postinst,libnih-dbus1.postinst}: Force an upgrade to | ||
2180 | + restart Upstart (to pick up new package version) if the running | ||
2181 | + instance supports it. | ||
2182 | + * Merge of important fixes from lp:~upstart-devel/libnih/nih | ||
2183 | + (LP: #776532, LP: #777097, LP: #834813, LP: #1123588). | ||
2184 | + | ||
2185 | + -- James Hunt <james.hunt@ubuntu.com> Thu, 14 Mar 2013 09:14:22 +0000 | ||
2186 | + | ||
2187 | +libnih (1.0.3-4ubuntu15) raring; urgency=low | ||
2188 | + | ||
2189 | + * Enable cross-building, sans adding :native build-dependencies. | ||
2190 | + See comments in debian/control. | ||
2191 | + * Lintian fixes. | ||
2192 | + | ||
2193 | + -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Tue, 08 Jan 2013 15:38:58 +0000 | ||
2194 | + | ||
2195 | +libnih (1.0.3-4ubuntu14) raring; urgency=low | ||
2196 | + | ||
2197 | + * Update dbus code generator to allow for empty lists for type 'as'. | ||
2198 | + This drops the != NULL check for NULL terminated arrays and moves the | ||
2199 | + iteration loop inside an 'if' statement. | ||
2200 | + | ||
2201 | + -- Stéphane Graber <stgraber@ubuntu.com> Thu, 13 Dec 2012 10:00:27 -0500 | ||
2202 | + | ||
2203 | +libnih (1.0.3-4ubuntu13) raring; urgency=low | ||
2204 | + | ||
2205 | + [ Petr Lautrbach <plautrba@redhat.com>, Dmitrijs Ledkovs ] | ||
2206 | + * Fallback to lstat, if dirent.d_type is not available (not portable) | ||
2207 | + (LP: #672643) (Closes: #695604) | ||
2208 | + | ||
2209 | + -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Tue, 11 Dec 2012 17:26:52 +0000 | ||
2210 | + | ||
2211 | +libnih (1.0.3-4ubuntu12) raring; urgency=low | ||
2212 | + | ||
2213 | + * nih/logging.c: Use our own __nih_abort_msg rather than the (e)glibc | ||
2214 | + private symbol __abort_msg to avoid upgrade issues (LP: #997359). | ||
2215 | + * nih/tests/test_logging.c: Update tests for __nih_abort_msg. | ||
2216 | + | ||
2217 | + -- James Hunt <james.hunt@ubuntu.com> Thu, 25 Oct 2012 10:57:30 +0100 | ||
2218 | + | ||
2219 | +libnih (1.0.3-4ubuntu11) quantal; urgency=low | ||
2220 | + | ||
2221 | + * Addition of debian/libnih-dbus1.postinst and | ||
2222 | + debian/libnih1.postinst to force Upstart re-exec on shutdown | ||
2223 | + to avoid unmounting disks uncleanly (LP: #740390). | ||
2224 | + | ||
2225 | + -- James Hunt <james.hunt@ubuntu.com> Wed, 03 Oct 2012 16:49:40 +0100 | ||
2226 | + | ||
2227 | +libnih (1.0.3-4ubuntu10) quantal; urgency=low | ||
2228 | + | ||
2229 | + * Update config.guess,sub for aarch64 | ||
2230 | + | ||
2231 | + -- Wookey <wookey@wookware.org> Mon, 01 Oct 2012 12:57:05 +0100 | ||
2232 | + | ||
2233 | +libnih (1.0.3-4ubuntu9) precise; urgency=low | ||
2234 | + | ||
2235 | + * Mark the nih-dbus-tool package Multi-Arch: foreign so it can be used as | ||
2236 | + a build-dependency of upstart when cross-building. | ||
2237 | + | ||
2238 | + -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 15 Feb 2012 22:57:50 -0800 | ||
2239 | + | ||
2240 | +libnih (1.0.3-4ubuntu8) precise; urgency=low | ||
2241 | + | ||
2242 | + * libnih1 needs a versioned Pre-Depend on libc6 instead of just a Depend, | ||
2243 | + because libc6 itself uses runlevel from the upstart package in its | ||
2244 | + preinst, which in turn uses libnih1, which needs to be loadable (i.e., | ||
2245 | + its symbol references resolve). We therefore need to ensure that | ||
2246 | + libnih1's dependencies are always unpacked before libnih1 itself is | ||
2247 | + unpacked. While having something further up the stack (such as upstart, | ||
2248 | + or something on top of upstart) being marked Essential: yes and with the | ||
2249 | + necessary pre-depends would let apt handle this for us with its | ||
2250 | + "immediate configuration" support, but for various reasons we don't want | ||
2251 | + to make upstart essential. LP: #508083. | ||
2252 | + | ||
2253 | + -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 10 Feb 2012 12:13:25 -0800 | ||
2254 | + | ||
2255 | +libnih (1.0.3-4ubuntu7) precise; urgency=low | ||
2256 | + | ||
2257 | + * Relax dependency on libc6. | ||
2258 | + | ||
2259 | + -- Matthias Klose <doko@ubuntu.com> Wed, 08 Feb 2012 23:43:21 +0100 | ||
2260 | + | ||
2261 | +libnih (1.0.3-4ubuntu6) precise; urgency=low | ||
2262 | + | ||
2263 | + * Rebuild with libc6-dev (>= 2.15~). | ||
2264 | + | ||
2265 | + -- Matthias Klose <doko@ubuntu.com> Wed, 08 Feb 2012 21:48:57 +0100 | ||
2266 | + | ||
2267 | +libnih (1.0.3-4ubuntu5) precise; urgency=low | ||
2268 | + | ||
2269 | + * Mark libnih-dev and libnih-dbus-dev Multi-Arch: same as well. | ||
2270 | + | ||
2271 | + -- Steve Langasek <steve.langasek@ubuntu.com> Sun, 06 Nov 2011 14:45:07 -0800 | ||
2272 | + | ||
2273 | +libnih (1.0.3-4ubuntu4) precise; urgency=low | ||
2274 | + | ||
2275 | + * Make libnih1 and libnih-dbus1 installable using multi-arch. | ||
2276 | + | ||
2277 | + -- James Hunt <james.hunt@ubuntu.com> Tue, 01 Nov 2011 14:25:09 -0400 | ||
2278 | + | ||
2279 | +libnih (1.0.3-4ubuntu3) precise; urgency=low | ||
2280 | + | ||
2281 | + * Build to install with eglibc-2.15. | ||
2282 | + | ||
2283 | + -- Matthias Klose <doko@ubuntu.com> Fri, 14 Oct 2011 14:05:03 +0200 | ||
2284 | + | ||
2285 | +libnih (1.0.3-4ubuntu2) oneiric; urgency=low | ||
2286 | + | ||
2287 | + * Use dpkg-buildflags to get the build flags. | ||
2288 | + * Build with the default build flags, don't hard-code -Os. LP: #791315. | ||
2289 | + | ||
2290 | + -- Matthias Klose <doko@ubuntu.com> Wed, 15 Jun 2011 16:45:42 +0200 | ||
2291 | + | ||
2292 | +libnih (1.0.3-4ubuntu1) oneiric; urgency=low | ||
2293 | + | ||
2294 | + * Merge from debian unstable. Retained Ubuntu Build-Depends and Priority. | ||
2295 | + | ||
2296 | + -- James Hunt <james.hunt@ubuntu.com> Mon, 23 May 2011 19:28:19 +0100 | ||
2297 | + | ||
2298 | +libnih (1.0.3-1ubuntu1) natty; urgency=low | ||
2299 | + | ||
2300 | + * Rebuild with libc6-dev (>= 2.13~). | ||
2301 | + | ||
2302 | + -- Matthias Klose <doko@ubuntu.com> Fri, 18 Feb 2011 12:09:29 +0100 | ||
2303 | + | ||
2304 | +libnih (1.0.3-1) natty; urgency=low | ||
2305 | + | ||
2306 | + * New upstream release: | ||
2307 | + - Added support for passing file descriptors over D-Bus to nih-dbus-tool | ||
2308 | + | ||
2309 | + -- Scott James Remnant <scott@ubuntu.com> Thu, 23 Dec 2010 22:28:24 +0000 | ||
2310 | + | ||
2311 | +libnih (1.0.2-2) natty; urgency=low | ||
2312 | + | ||
2313 | + * Revert the previous upload. It is never acceptable to simply disable | ||
2314 | + tests, especially when it turns out that the test that was disabled | ||
2315 | + was failing because there was a serious bug that could cause kernel | ||
2316 | + panics for people on boot. | ||
2317 | + | ||
2318 | + Test suites are here for a reason. | ||
2319 | + | ||
2320 | + * Bumped libdbus Build-Dependency to the version with the bug fix that | ||
2321 | + caused the test suite to fail. | ||
2322 | + | ||
2323 | + -- Scott James Remnant <scott@ubuntu.com> Wed, 08 Dec 2010 19:40:15 +0000 | ||
2324 | + | ||
2325 | +libnih (1.0.2-1ubuntu3) natty; urgency=low | ||
2326 | + | ||
2327 | + * Disable some tests on ppc64 to build an initial package. | ||
2328 | + | ||
2329 | + -- Matthias Klose <doko@ubuntu.com> Thu, 18 Nov 2010 10:59:38 +0100 | ||
2330 | + | ||
2331 | +libnih (1.0.2-1ubuntu2) maverick; urgency=low | ||
2332 | + | ||
2333 | + * Re-add -fPIE to the testsuite on armel, removing all armel-specific tests; | ||
2334 | + current gcc-4.4 don't seem affected by the ICE anymore (see LP #398403). | ||
2335 | + | ||
2336 | + -- Loïc Minier <loic.minier@linaro.org> Mon, 23 Aug 2010 10:25:31 +0200 | ||
2337 | + | ||
2338 | +libnih (1.0.2-1ubuntu1) maverick; urgency=low | ||
2339 | + | ||
2340 | + * Rebuild with libc6-dev (>= 2.12~), after checking that | ||
2341 | + __abort_msg is available with the same signature in eglibc 2.12. | ||
2342 | + * Don't build the testsuite with -fPIE on armel; LP: #398403. | ||
2343 | + | ||
2344 | + -- Matthias Klose <doko@ubuntu.com> Sun, 30 May 2010 02:54:56 +0200 | ||
2345 | + | ||
2346 | +libnih (1.0.2-1) maverick; urgency=low | ||
2347 | + | ||
2348 | + * New upstream release: | ||
2349 | + - Rename AC_COPYRIGHT to NIH_COPYRIGHT to avoid conflict with other | ||
2350 | + packages. | ||
2351 | + - Add serial to libnih.m4 | ||
2352 | + - Add NIH_WITH_LOCAL_LIBNIH macro. | ||
2353 | + | ||
2354 | + * Fix use of ${Source-Version} to be ${binary:Version} | ||
2355 | + * Add debian/source/format with "1.0" to be future compatible. | ||
2356 | + * Bump standards version. | ||
2357 | + | ||
2358 | + -- Scott James Remnant <scott@ubuntu.com> Tue, 27 Apr 2010 10:49:55 -0700 | ||
2359 | + | ||
2360 | +libnih (1.0.1-1) lucid; urgency=low | ||
2361 | + | ||
2362 | + * New upstream release: | ||
2363 | + - Add missing __nih_* symbols to linker version script so that we | ||
2364 | + can link Upstart's test suite. | ||
2365 | + - Glibc __abort_msg symbol now only linked as a weak symbol. | ||
2366 | + | ||
2367 | + -- Scott James Remnant <scott@ubuntu.com> Thu, 04 Feb 2010 14:53:26 -0800 | ||
2368 | + | ||
2369 | +libnih (1.0.0-2build1) lucid; urgency=low | ||
2370 | + | ||
2371 | + * Rebuild to pick up relaxed dependency on libc6, after checking that | ||
2372 | + __abort_msg is available with the same signature in eglibc 2.11. | ||
2373 | + LP: #508702. | ||
2374 | + | ||
2375 | + -- Matthias Klose <doko@ubuntu.com> Mon, 18 Jan 2010 16:09:13 +0100 | ||
2376 | + | ||
2377 | +libnih (1.0.0-2) lucid; urgency=low | ||
2378 | + | ||
2379 | + * debian/control: Add build-dependency on dbus so the test suite can | ||
2380 | + pass on the buildds. | ||
2381 | + | ||
2382 | + -- Scott James Remnant <scott@ubuntu.com> Sat, 28 Nov 2009 23:28:27 +0000 | ||
2383 | + | ||
2384 | +libnih (1.0.0-1) lucid; urgency=low | ||
2385 | + | ||
2386 | + * First upstream release. Previously this code was included in the | ||
2387 | + upstart, mountall and ureadahead source packages. | ||
2388 | + | ||
2389 | + -- Scott James Remnant <scott@ubuntu.com> Sat, 28 Nov 2009 21:14:00 +0000 | ||
2390 | --- libnih-1.0.3.orig/debian/source/format | ||
2391 | +++ libnih-1.0.3/debian/source/format | ||
2392 | @@ -0,0 +1 @@ | ||
2393 | +1.0 | ||
2394 | --- libnih-1.0.3.orig/nih-dbus/dbus_proxy.h | ||
2395 | +++ libnih-1.0.3/nih-dbus/dbus_proxy.h | ||
2396 | @@ -146,14 +146,14 @@ | ||
2397 | const char *name, const char *path, | ||
2398 | NihDBusLostHandler lost_handler, | ||
2399 | void *data) | ||
2400 | - __attribute__ ((warn_unused_result, malloc)); | ||
2401 | + __attribute__ ((warn_unused_result)); | ||
2402 | |||
2403 | NihDBusProxySignal *nih_dbus_proxy_connect (NihDBusProxy *proxy, | ||
2404 | const NihDBusInterface *interface, | ||
2405 | const char *name, | ||
2406 | NihDBusSignalHandler handler, | ||
2407 | void *data) | ||
2408 | - __attribute__ ((warn_unused_result, malloc)); | ||
2409 | + __attribute__ ((warn_unused_result)); | ||
2410 | |||
2411 | NIH_END_EXTERN | ||
2412 | |||
2413 | --- libnih-1.0.3.orig/nih-dbus/dbus_object.h | ||
2414 | +++ libnih-1.0.3/nih-dbus/dbus_object.h | ||
2415 | @@ -61,8 +61,7 @@ | ||
2416 | DBusConnection *connection, | ||
2417 | const char *path, | ||
2418 | const NihDBusInterface **interfaces, | ||
2419 | - void *data) | ||
2420 | - __attribute__ ((malloc)); | ||
2421 | + void *data); | ||
2422 | |||
2423 | NIH_END_EXTERN | ||
2424 | |||
2425 | --- libnih-1.0.3.orig/nih-dbus/dbus_util.h | ||
2426 | +++ libnih-1.0.3/nih-dbus/dbus_util.h | ||
2427 | @@ -26,7 +26,7 @@ | ||
2428 | NIH_BEGIN_EXTERN | ||
2429 | |||
2430 | char *nih_dbus_path (const void *parent, const char *root, ...) | ||
2431 | - __attribute__ ((sentinel, warn_unused_result, malloc)); | ||
2432 | + __attribute__ ((sentinel, warn_unused_result)); | ||
2433 | |||
2434 | NIH_END_EXTERN | ||
2435 | |||
2436 | --- libnih-1.0.3.orig/nih-dbus/dbus_pending_data.h | ||
2437 | +++ libnih-1.0.3/nih-dbus/dbus_pending_data.h | ||
2438 | @@ -104,7 +104,7 @@ | ||
2439 | NihDBusReplyHandler handler, | ||
2440 | NihDBusErrorHandler error_handler, | ||
2441 | void *data) | ||
2442 | - __attribute__ ((warn_unused_result, malloc)); | ||
2443 | + __attribute__ ((warn_unused_result)); | ||
2444 | |||
2445 | NIH_END_EXTERN | ||
2446 | |||
2447 | --- libnih-1.0.3.orig/nih-dbus/dbus_proxy.c | ||
2448 | +++ libnih-1.0.3/nih-dbus/dbus_proxy.c | ||
2449 | @@ -46,11 +46,11 @@ | ||
2450 | __attribute__ ((warn_unused_result)); | ||
2451 | static char *nih_dbus_proxy_name_rule (const void *parent, | ||
2452 | NihDBusProxy *proxy) | ||
2453 | - __attribute__ ((warn_unused_result, malloc)); | ||
2454 | + __attribute__ ((warn_unused_result)); | ||
2455 | static int nih_dbus_proxy_signal_destroy (NihDBusProxySignal *proxied); | ||
2456 | static char *nih_dbus_proxy_signal_rule (const void *parent, | ||
2457 | NihDBusProxySignal *proxied) | ||
2458 | - __attribute__ ((warn_unused_result, malloc)); | ||
2459 | + __attribute__ ((warn_unused_result)); | ||
2460 | |||
2461 | /* Prototypes for handler functions */ | ||
2462 | static DBusHandlerResult nih_dbus_proxy_name_owner_changed (DBusConnection *connection, | ||
2463 | --- libnih-1.0.3.orig/nih-dbus-tool/symbol.c | ||
2464 | +++ libnih-1.0.3/nih-dbus-tool/symbol.c | ||
2465 | @@ -40,10 +40,10 @@ | ||
2466 | /* Prototypes for static functions */ | ||
2467 | static char *symbol_strcat_interface (char **str, const void *parent, | ||
2468 | const char *format, ...) | ||
2469 | - __attribute__ ((format (printf, 3, 4), warn_unused_result, malloc)); | ||
2470 | + __attribute__ ((format (printf, 3, 4), warn_unused_result)); | ||
2471 | static char *symbol_strcat_title (char **str, const void *parent, | ||
2472 | const char *format, ...) | ||
2473 | - __attribute__ ((format (printf, 3, 4), warn_unused_result, malloc)); | ||
2474 | + __attribute__ ((format (printf, 3, 4), warn_unused_result)); | ||
2475 | |||
2476 | |||
2477 | /** | ||
2478 | --- libnih-1.0.3.orig/nih-dbus-tool/demarshal.h | ||
2479 | +++ libnih-1.0.3/nih-dbus-tool/demarshal.h | ||
2480 | @@ -37,7 +37,7 @@ | ||
2481 | const char *prefix, const char *interface_symbol, | ||
2482 | const char *member_symbol, const char *symbol, | ||
2483 | NihList *structs) | ||
2484 | - __attribute__ ((warn_unused_result, malloc)); | ||
2485 | + __attribute__ ((warn_unused_result)); | ||
2486 | |||
2487 | NIH_END_EXTERN | ||
2488 | |||
2489 | --- libnih-1.0.3.orig/nih-dbus-tool/symbol.h | ||
2490 | +++ libnih-1.0.3/nih-dbus-tool/symbol.h | ||
2491 | @@ -28,22 +28,22 @@ | ||
2492 | int symbol_valid (const char *symbol); | ||
2493 | |||
2494 | char *symbol_from_name (const void *parent, const char *name) | ||
2495 | - __attribute__ ((warn_unused_result, malloc)); | ||
2496 | + __attribute__ ((warn_unused_result)); | ||
2497 | |||
2498 | char *symbol_impl (const void *parent, const char *prefix, | ||
2499 | const char *interface_name, const char *name, | ||
2500 | const char *postfix) | ||
2501 | - __attribute__ ((warn_unused_result, malloc)); | ||
2502 | + __attribute__ ((warn_unused_result)); | ||
2503 | |||
2504 | char *symbol_extern (const void *parent, const char *prefix, | ||
2505 | const char *interface_symbol, const char *midfix, | ||
2506 | const char *symbol, const char *postfix) | ||
2507 | - __attribute__ ((warn_unused_result, malloc)); | ||
2508 | + __attribute__ ((warn_unused_result)); | ||
2509 | |||
2510 | char *symbol_typedef (const void *parent, const char *prefix, | ||
2511 | const char *interface_symbol, const char *midfix, | ||
2512 | const char *symbol, const char *postfix) | ||
2513 | - __attribute__ ((warn_unused_result, malloc)); | ||
2514 | + __attribute__ ((warn_unused_result)); | ||
2515 | |||
2516 | NIH_END_EXTERN | ||
2517 | |||
2518 | --- libnih-1.0.3.orig/nih-dbus-tool/output.h | ||
2519 | +++ libnih-1.0.3/nih-dbus-tool/output.h | ||
2520 | @@ -35,9 +35,9 @@ | ||
2521 | __attribute__ ((warn_unused_result)); | ||
2522 | |||
2523 | char *output_preamble (const void *parent, const char *path) | ||
2524 | - __attribute__ ((warn_unused_result, malloc)); | ||
2525 | + __attribute__ ((warn_unused_result)); | ||
2526 | char *output_sentinel (const void *parent, const char *path) | ||
2527 | - __attribute__ ((warn_unused_result, malloc)); | ||
2528 | + __attribute__ ((warn_unused_result)); | ||
2529 | |||
2530 | NIH_END_EXTERN | ||
2531 | |||
2532 | --- libnih-1.0.3.orig/nih-dbus-tool/parse.h | ||
2533 | +++ libnih-1.0.3/nih-dbus-tool/parse.h | ||
2534 | @@ -95,7 +95,7 @@ | ||
2535 | |||
2536 | ParseStack *parse_stack_push (const void *parent, NihList *stack, | ||
2537 | ParseStackType type, void *data) | ||
2538 | - __attribute__ ((warn_unused_result, malloc)); | ||
2539 | + __attribute__ ((warn_unused_result)); | ||
2540 | ParseStack *parse_stack_top (NihList *stack); | ||
2541 | |||
2542 | void parse_start_tag (XML_Parser xmlp, const char *tag, | ||
2543 | @@ -103,7 +103,7 @@ | ||
2544 | void parse_end_tag (XML_Parser xmlp, const char *tag); | ||
2545 | |||
2546 | Node * parse_xml (const void *parent, int fd, const char *filename) | ||
2547 | - __attribute__ ((warn_unused_result, malloc)); | ||
2548 | + __attribute__ ((warn_unused_result)); | ||
2549 | |||
2550 | NIH_END_EXTERN | ||
2551 | |||
2552 | --- libnih-1.0.3.orig/nih-dbus-tool/type.h | ||
2553 | +++ libnih-1.0.3/nih-dbus-tool/type.h | ||
2554 | @@ -94,43 +94,43 @@ | ||
2555 | |||
2556 | char * type_of (const void * parent, | ||
2557 | DBusSignatureIter *iter) | ||
2558 | - __attribute__ ((warn_unused_result, malloc)); | ||
2559 | + __attribute__ ((warn_unused_result)); | ||
2560 | |||
2561 | TypeVar * type_var_new (const void *parent, const char *type, | ||
2562 | const char *name) | ||
2563 | - __attribute__ ((warn_unused_result, malloc)); | ||
2564 | + __attribute__ ((warn_unused_result)); | ||
2565 | char * type_var_to_string (const void *parent, TypeVar *var) | ||
2566 | - __attribute__ ((warn_unused_result, malloc)); | ||
2567 | + __attribute__ ((warn_unused_result)); | ||
2568 | char * type_var_layout (const void *parent, NihList *vars) | ||
2569 | - __attribute__ ((warn_unused_result, malloc)); | ||
2570 | + __attribute__ ((warn_unused_result)); | ||
2571 | |||
2572 | TypeFunc * type_func_new (const void *parent, const char *type, | ||
2573 | const char *name) | ||
2574 | - __attribute__ ((warn_unused_result, malloc)); | ||
2575 | + __attribute__ ((warn_unused_result)); | ||
2576 | char * type_func_to_string (const void *parent, TypeFunc *func) | ||
2577 | - __attribute__ ((warn_unused_result, malloc)); | ||
2578 | + __attribute__ ((warn_unused_result)); | ||
2579 | char * type_func_to_typedef (const void *parent, TypeFunc *func) | ||
2580 | - __attribute__ ((warn_unused_result, malloc)); | ||
2581 | + __attribute__ ((warn_unused_result)); | ||
2582 | char * type_func_layout (const void *parent, NihList *funcs) | ||
2583 | - __attribute__ ((warn_unused_result, malloc)); | ||
2584 | + __attribute__ ((warn_unused_result)); | ||
2585 | |||
2586 | TypeStruct *type_struct_new (const void *parent, const char *name) | ||
2587 | - __attribute__ ((warn_unused_result, malloc)); | ||
2588 | + __attribute__ ((warn_unused_result)); | ||
2589 | char * type_struct_to_string (const void *parent, TypeStruct *structure) | ||
2590 | - __attribute__ ((warn_unused_result, malloc)); | ||
2591 | + __attribute__ ((warn_unused_result)); | ||
2592 | |||
2593 | char * type_to_const (char **type, const void *parent) | ||
2594 | - __attribute__ ((warn_unused_result, malloc)); | ||
2595 | + __attribute__ ((warn_unused_result)); | ||
2596 | char * type_to_pointer (char **type, const void *parent) | ||
2597 | - __attribute__ ((warn_unused_result, malloc)); | ||
2598 | + __attribute__ ((warn_unused_result)); | ||
2599 | char * type_to_static (char **type, const void *parent) | ||
2600 | - __attribute__ ((warn_unused_result, malloc)); | ||
2601 | + __attribute__ ((warn_unused_result)); | ||
2602 | char * type_to_extern (char **type, const void *parent) | ||
2603 | - __attribute__ ((warn_unused_result, malloc)); | ||
2604 | + __attribute__ ((warn_unused_result)); | ||
2605 | |||
2606 | char * type_strcat_assert (char **block, const void *parent, | ||
2607 | TypeVar *var, TypeVar *prev, TypeVar *next) | ||
2608 | - __attribute__ ((warn_unused_result, malloc)); | ||
2609 | + __attribute__ ((warn_unused_result)); | ||
2610 | |||
2611 | NIH_END_EXTERN | ||
2612 | |||
2613 | --- libnih-1.0.3.orig/nih-dbus-tool/argument.h | ||
2614 | +++ libnih-1.0.3/nih-dbus-tool/argument.h | ||
2615 | @@ -61,7 +61,7 @@ | ||
2616 | |||
2617 | Argument *argument_new (const void *parent, const char *name, | ||
2618 | const char *type, NihDBusArgDir direction) | ||
2619 | - __attribute__ ((warn_unused_result, malloc)); | ||
2620 | + __attribute__ ((warn_unused_result)); | ||
2621 | |||
2622 | int argument_start_tag (XML_Parser xmlp, const char *tag, | ||
2623 | char * const *attr) | ||
2624 | --- libnih-1.0.3.orig/nih-dbus-tool/indent.h | ||
2625 | +++ libnih-1.0.3/nih-dbus-tool/indent.h | ||
2626 | @@ -26,9 +26,9 @@ | ||
2627 | NIH_BEGIN_EXTERN | ||
2628 | |||
2629 | char *indent (char **str, const void *parent, int level) | ||
2630 | - __attribute__ ((warn_unused_result, malloc)); | ||
2631 | + __attribute__ ((warn_unused_result)); | ||
2632 | char *comment (char **str, const void *parent) | ||
2633 | - __attribute__ ((warn_unused_result, malloc)); | ||
2634 | + __attribute__ ((warn_unused_result)); | ||
2635 | |||
2636 | NIH_END_EXTERN | ||
2637 | |||
2638 | --- libnih-1.0.3.orig/nih-dbus-tool/main.c | ||
2639 | +++ libnih-1.0.3/nih-dbus-tool/main.c | ||
2640 | @@ -52,10 +52,10 @@ | ||
2641 | /* Prototypes for local functions */ | ||
2642 | char *source_file_path (const void *parent, const char *output_path, | ||
2643 | const char *filename) | ||
2644 | - __attribute__ ((warn_unused_result, malloc)); | ||
2645 | + __attribute__ ((warn_unused_result)); | ||
2646 | char *header_file_path (const void *parent, const char *output_path, | ||
2647 | const char *filename) | ||
2648 | - __attribute__ ((warn_unused_result, malloc)); | ||
2649 | + __attribute__ ((warn_unused_result)); | ||
2650 | |||
2651 | |||
2652 | /** | ||
2653 | --- libnih-1.0.3.orig/nih-dbus-tool/signal.h | ||
2654 | +++ libnih-1.0.3/nih-dbus-tool/signal.h | ||
2655 | @@ -58,7 +58,7 @@ | ||
2656 | int signal_name_valid (const char *name); | ||
2657 | |||
2658 | Signal * signal_new (const void *parent, const char *name) | ||
2659 | - __attribute__ ((warn_unused_result, malloc)); | ||
2660 | + __attribute__ ((warn_unused_result)); | ||
2661 | |||
2662 | int signal_start_tag (XML_Parser xmlp, const char *tag, | ||
2663 | char * const *attr) | ||
2664 | @@ -76,18 +76,18 @@ | ||
2665 | char * signal_object_function (const void *parent, const char *prefix, | ||
2666 | Interface *interface, Signal *signal, | ||
2667 | NihList *prototypes, NihList *structs) | ||
2668 | - __attribute__ ((warn_unused_result, malloc)); | ||
2669 | + __attribute__ ((warn_unused_result)); | ||
2670 | |||
2671 | char * signal_proxy_function (const void *parent, const char *prefix, | ||
2672 | Interface *interface, Signal *signal, | ||
2673 | NihList *prototypes, NihList *typedefs, | ||
2674 | NihList *structs) | ||
2675 | - __attribute__ ((warn_unused_result, malloc)); | ||
2676 | + __attribute__ ((warn_unused_result)); | ||
2677 | |||
2678 | char * signal_args_array (const void *parent, const char *prefix, | ||
2679 | Interface *interface, Signal *signal, | ||
2680 | NihList *prototypes) | ||
2681 | - __attribute__ ((warn_unused_result, malloc)); | ||
2682 | + __attribute__ ((warn_unused_result)); | ||
2683 | |||
2684 | NIH_END_EXTERN | ||
2685 | |||
2686 | --- libnih-1.0.3.orig/nih-dbus-tool/marshal.c | ||
2687 | +++ libnih-1.0.3/nih-dbus-tool/marshal.c | ||
2688 | @@ -49,7 +49,7 @@ | ||
2689 | const char *prefix, const char *interface_symbol, | ||
2690 | const char *member_symbol, const char *symbol, | ||
2691 | NihList *structs) | ||
2692 | - __attribute__ ((warn_unused_result, malloc)); | ||
2693 | + __attribute__ ((warn_unused_result)); | ||
2694 | static char *marshal_array (const void *parent, | ||
2695 | DBusSignatureIter *iter, | ||
2696 | const char *iter_name, const char *name, | ||
2697 | @@ -58,7 +58,7 @@ | ||
2698 | const char *prefix, const char *interface_symbol, | ||
2699 | const char *member_symbol, const char *symbol, | ||
2700 | NihList *structs) | ||
2701 | - __attribute__ ((warn_unused_result, malloc)); | ||
2702 | + __attribute__ ((warn_unused_result)); | ||
2703 | static char *marshal_struct (const void *parent, | ||
2704 | DBusSignatureIter *iter, | ||
2705 | const char *iter_name, const char *name, | ||
2706 | @@ -67,7 +67,7 @@ | ||
2707 | const char *prefix, const char *interface_symbol, | ||
2708 | const char *member_symbol, const char *symbol, | ||
2709 | NihList *structs) | ||
2710 | - __attribute__ ((warn_unused_result, malloc)); | ||
2711 | + __attribute__ ((warn_unused_result)); | ||
2712 | |||
2713 | |||
2714 | /** | ||
2715 | @@ -364,6 +364,7 @@ | ||
2716 | nih_local TypeVar *element_len_var = NULL; | ||
2717 | nih_local char * block = NULL; | ||
2718 | nih_local char * vars_block = NULL; | ||
2719 | + nih_local char * loop_block = NULL; | ||
2720 | |||
2721 | nih_assert (iter != NULL); | ||
2722 | nih_assert (iter_name != NULL); | ||
2723 | @@ -448,7 +449,7 @@ | ||
2724 | nih_list_add (locals, &array_iter_var->entry); | ||
2725 | |||
2726 | if (dbus_type_is_fixed (element_type)) { | ||
2727 | - if (! nih_strcat_sprintf (&code, parent, | ||
2728 | + if (! nih_strcat_sprintf (&loop_block, parent, | ||
2729 | "for (size_t %s = 0; %s < %s; %s++) {\n", | ||
2730 | loop_name, loop_name, len_name, loop_name)) { | ||
2731 | nih_free (code); | ||
2732 | @@ -456,6 +457,12 @@ | ||
2733 | } | ||
2734 | } else { | ||
2735 | if (! nih_strcat_sprintf (&code, parent, | ||
2736 | + "if (%s) {\n", | ||
2737 | + name)) { | ||
2738 | + nih_free (code); | ||
2739 | + return NULL; | ||
2740 | + } | ||
2741 | + if (! nih_strcat_sprintf (&loop_block, parent, | ||
2742 | "for (size_t %s = 0; %s[%s]; %s++) {\n", | ||
2743 | loop_name, name, loop_name, loop_name)) { | ||
2744 | nih_free (code); | ||
2745 | @@ -576,7 +583,7 @@ | ||
2746 | } | ||
2747 | |||
2748 | |||
2749 | - if (! nih_strcat_sprintf (&code, parent, | ||
2750 | + if (! nih_strcat_sprintf (&loop_block, parent, | ||
2751 | "%s" | ||
2752 | "\n" | ||
2753 | "%s" | ||
2754 | @@ -590,9 +597,34 @@ | ||
2755 | } | ||
2756 | |||
2757 | /* Close the container again */ | ||
2758 | + if (! nih_strcat_sprintf (&loop_block, parent, | ||
2759 | + "}\n")) { | ||
2760 | + nih_free (code); | ||
2761 | + return NULL; | ||
2762 | + } | ||
2763 | + | ||
2764 | + if (dbus_type_is_fixed (element_type)) { | ||
2765 | + if (! nih_strcat_sprintf (&code, parent, | ||
2766 | + "%s\n", loop_block)) { | ||
2767 | + nih_free (code); | ||
2768 | + return NULL; | ||
2769 | + } | ||
2770 | + } | ||
2771 | + else { | ||
2772 | + if (! indent (&loop_block, NULL, 1)) { | ||
2773 | + nih_free (code); | ||
2774 | + return NULL; | ||
2775 | + } | ||
2776 | + | ||
2777 | + if (! nih_strcat_sprintf (&code, parent, | ||
2778 | + "%s" | ||
2779 | + "}\n\n", loop_block)) { | ||
2780 | + nih_free (code); | ||
2781 | + return NULL; | ||
2782 | + } | ||
2783 | + } | ||
2784 | + | ||
2785 | if (! nih_strcat_sprintf (&code, parent, | ||
2786 | - "}\n" | ||
2787 | - "\n" | ||
2788 | "if (! dbus_message_iter_close_container (&%s, &%s)) {\n" | ||
2789 | "%s" | ||
2790 | "}\n", | ||
2791 | --- libnih-1.0.3.orig/nih-dbus-tool/demarshal.c | ||
2792 | +++ libnih-1.0.3/nih-dbus-tool/demarshal.c | ||
2793 | @@ -51,7 +51,7 @@ | ||
2794 | const char *prefix, const char *interface_symbol, | ||
2795 | const char *member_symbol, const char *symbol, | ||
2796 | NihList *structs) | ||
2797 | - __attribute__ ((warn_unused_result, malloc)); | ||
2798 | + __attribute__ ((warn_unused_result)); | ||
2799 | static char *demarshal_array (const void *parent, | ||
2800 | DBusSignatureIter *iter, | ||
2801 | const char *parent_name, | ||
2802 | @@ -62,7 +62,7 @@ | ||
2803 | const char *prefix, const char *interface_symbol, | ||
2804 | const char *member_symbol, const char *symbol, | ||
2805 | NihList *structs) | ||
2806 | - __attribute__ ((warn_unused_result, malloc)); | ||
2807 | + __attribute__ ((warn_unused_result)); | ||
2808 | static char *demarshal_struct (const void *parent, | ||
2809 | DBusSignatureIter *iter, | ||
2810 | const char *parent_name, | ||
2811 | @@ -73,7 +73,7 @@ | ||
2812 | const char *prefix, const char *interface_symbol, | ||
2813 | const char *member_symbol, const char *symbol, | ||
2814 | NihList *structs) | ||
2815 | - __attribute__ ((warn_unused_result, malloc)); | ||
2816 | + __attribute__ ((warn_unused_result)); | ||
2817 | |||
2818 | |||
2819 | /** | ||
2820 | --- libnih-1.0.3.orig/nih-dbus-tool/interface.h | ||
2821 | +++ libnih-1.0.3/nih-dbus-tool/interface.h | ||
2822 | @@ -61,7 +61,7 @@ | ||
2823 | |||
2824 | Interface *interface_new (const void *parent, | ||
2825 | const char *name) | ||
2826 | - __attribute__ ((warn_unused_result, malloc)); | ||
2827 | + __attribute__ ((warn_unused_result)); | ||
2828 | |||
2829 | int interface_start_tag (XML_Parser xmlp, | ||
2830 | const char *tag, | ||
2831 | @@ -81,26 +81,26 @@ | ||
2832 | Interface *interface, | ||
2833 | int with_handlers, | ||
2834 | NihList *prototypes) | ||
2835 | - __attribute__ ((warn_unused_result, malloc)); | ||
2836 | + __attribute__ ((warn_unused_result)); | ||
2837 | char * interface_signals_array (const void *parent, | ||
2838 | const char *prefix, | ||
2839 | Interface *interface, | ||
2840 | int with_filters, | ||
2841 | NihList *prototypes) | ||
2842 | - __attribute__ ((warn_unused_result, malloc)); | ||
2843 | + __attribute__ ((warn_unused_result)); | ||
2844 | char * interface_properties_array (const void *parent, | ||
2845 | const char *prefix, | ||
2846 | Interface *interface, | ||
2847 | int with_handlers, | ||
2848 | NihList *prototypes) | ||
2849 | - __attribute__ ((warn_unused_result, malloc)); | ||
2850 | + __attribute__ ((warn_unused_result)); | ||
2851 | |||
2852 | char * interface_struct (const void *parent, | ||
2853 | const char *prefix, | ||
2854 | Interface *interface, | ||
2855 | int object, | ||
2856 | NihList *prototypes) | ||
2857 | - __attribute__ ((warn_unused_result, malloc)); | ||
2858 | + __attribute__ ((warn_unused_result)); | ||
2859 | |||
2860 | |||
2861 | char * interface_proxy_get_all_function (const void *parent, | ||
2862 | @@ -108,7 +108,7 @@ | ||
2863 | Interface *interface, | ||
2864 | NihList *prototypes, | ||
2865 | NihList *structs) | ||
2866 | - __attribute__ ((warn_unused_result, malloc)); | ||
2867 | + __attribute__ ((warn_unused_result)); | ||
2868 | |||
2869 | char * interface_proxy_get_all_notify_function (const void *parent, | ||
2870 | const char *prefix, | ||
2871 | @@ -116,14 +116,14 @@ | ||
2872 | NihList *prototypes, | ||
2873 | NihList *typedefs, | ||
2874 | NihList *structs) | ||
2875 | - __attribute__ ((warn_unused_result, malloc)); | ||
2876 | + __attribute__ ((warn_unused_result)); | ||
2877 | |||
2878 | char * interface_proxy_get_all_sync_function (const void *parent, | ||
2879 | const char *prefix, | ||
2880 | Interface *interface, | ||
2881 | NihList *prototypes, | ||
2882 | NihList *structs) | ||
2883 | - __attribute__ ((warn_unused_result, malloc)); | ||
2884 | + __attribute__ ((warn_unused_result)); | ||
2885 | |||
2886 | NIH_END_EXTERN | ||
2887 | |||
2888 | --- libnih-1.0.3.orig/nih-dbus-tool/method.h | ||
2889 | +++ libnih-1.0.3/nih-dbus-tool/method.h | ||
2890 | @@ -62,7 +62,7 @@ | ||
2891 | int method_name_valid (const char *name); | ||
2892 | |||
2893 | Method * method_new (const void *parent, const char *name) | ||
2894 | - __attribute__ ((warn_unused_result, malloc)); | ||
2895 | + __attribute__ ((warn_unused_result)); | ||
2896 | |||
2897 | int method_start_tag (XML_Parser xmlp, const char *tag, | ||
2898 | char * const *attr) | ||
2899 | @@ -82,33 +82,33 @@ | ||
2900 | Interface *interface, Method *method, | ||
2901 | NihList *prototypes, NihList *handlers, | ||
2902 | NihList *structs) | ||
2903 | - __attribute__ ((warn_unused_result, malloc)); | ||
2904 | + __attribute__ ((warn_unused_result)); | ||
2905 | |||
2906 | char * method_reply_function (const void *parent, const char *prefix, | ||
2907 | Interface *interface, Method *method, | ||
2908 | NihList *prototypes, NihList *structs) | ||
2909 | - __attribute__ ((warn_unused_result, malloc)); | ||
2910 | + __attribute__ ((warn_unused_result)); | ||
2911 | |||
2912 | char * method_proxy_function (const void *parent, const char *prefix, | ||
2913 | Interface *interface, Method *method, | ||
2914 | NihList *prototypes, NihList *structs) | ||
2915 | - __attribute__ ((warn_unused_result, malloc)); | ||
2916 | + __attribute__ ((warn_unused_result)); | ||
2917 | |||
2918 | char * method_proxy_notify_function (const void *parent, const char *prefix, | ||
2919 | Interface *interface, Method *method, | ||
2920 | NihList *prototypes, NihList *typedefs, | ||
2921 | NihList *structs) | ||
2922 | - __attribute__ ((warn_unused_result, malloc)); | ||
2923 | + __attribute__ ((warn_unused_result)); | ||
2924 | |||
2925 | char * method_proxy_sync_function (const void *parent, const char *prefix, | ||
2926 | Interface *interface, Method *method, | ||
2927 | NihList *prototypes, NihList *structs) | ||
2928 | - __attribute__ ((warn_unused_result, malloc)); | ||
2929 | + __attribute__ ((warn_unused_result)); | ||
2930 | |||
2931 | char * method_args_array (const void *parent, const char *prefix, | ||
2932 | Interface *interface, Method *method, | ||
2933 | NihList *prototypes) | ||
2934 | - __attribute__ ((warn_unused_result, malloc)); | ||
2935 | + __attribute__ ((warn_unused_result)); | ||
2936 | |||
2937 | NIH_END_EXTERN | ||
2938 | |||
2939 | --- libnih-1.0.3.orig/nih-dbus-tool/node.h | ||
2940 | +++ libnih-1.0.3/nih-dbus-tool/node.h | ||
2941 | @@ -47,7 +47,7 @@ | ||
2942 | int node_path_valid (const char *name); | ||
2943 | |||
2944 | Node * node_new (const void *parent, const char *path) | ||
2945 | - __attribute__ ((warn_unused_result, malloc)); | ||
2946 | + __attribute__ ((warn_unused_result)); | ||
2947 | |||
2948 | int node_start_tag (XML_Parser xmlp, const char *tag, | ||
2949 | char * const *attr) | ||
2950 | @@ -59,18 +59,18 @@ | ||
2951 | |||
2952 | char * node_interfaces_array (const void *parent, const char *prefix, | ||
2953 | Node *node, int object, NihList *prototypes) | ||
2954 | - __attribute__ ((warn_unused_result, malloc)); | ||
2955 | + __attribute__ ((warn_unused_result)); | ||
2956 | |||
2957 | char * node_object_functions (const void *parent, const char *prefix, | ||
2958 | Node *node, | ||
2959 | NihList *prototypes, NihList *handlers, | ||
2960 | NihList *structs, NihList *externs) | ||
2961 | - __attribute__ ((warn_unused_result, malloc)); | ||
2962 | + __attribute__ ((warn_unused_result)); | ||
2963 | char * node_proxy_functions (const void *parent, const char *prefix, | ||
2964 | Node *node, | ||
2965 | NihList *prototypes, NihList *structs, | ||
2966 | NihList *typedefs, NihList *externs) | ||
2967 | - __attribute__ ((warn_unused_result, malloc)); | ||
2968 | + __attribute__ ((warn_unused_result)); | ||
2969 | |||
2970 | NIH_END_EXTERN | ||
2971 | |||
2972 | --- libnih-1.0.3.orig/nih-dbus-tool/marshal.h | ||
2973 | +++ libnih-1.0.3/nih-dbus-tool/marshal.h | ||
2974 | @@ -35,7 +35,7 @@ | ||
2975 | const char *prefix, const char *interface_symbol, | ||
2976 | const char *member_symbol, const char *symbol, | ||
2977 | NihList *structs) | ||
2978 | - __attribute__ ((warn_unused_result, malloc)); | ||
2979 | + __attribute__ ((warn_unused_result)); | ||
2980 | |||
2981 | NIH_END_EXTERN | ||
2982 | |||
2983 | --- libnih-1.0.3.orig/nih-dbus-tool/type.c | ||
2984 | +++ libnih-1.0.3/nih-dbus-tool/type.c | ||
2985 | @@ -1101,7 +1101,7 @@ | ||
2986 | nih_assert (block != NULL); | ||
2987 | nih_assert (var != NULL); | ||
2988 | |||
2989 | - if (! strchr (var->type, '*')) | ||
2990 | + if (! strchr (var->type, '*') || ! strcmp (var->type, "char * const *")) | ||
2991 | return *block; | ||
2992 | |||
2993 | if (next && (! strcmp (next->type, "size_t"))) { | ||
2994 | --- libnih-1.0.3.orig/nih-dbus-tool/property.h | ||
2995 | +++ libnih-1.0.3/nih-dbus-tool/property.h | ||
2996 | @@ -65,7 +65,7 @@ | ||
2997 | const char *name, | ||
2998 | const char *type, | ||
2999 | NihDBusAccess access) | ||
3000 | - __attribute__ ((warn_unused_result, malloc)); | ||
3001 | + __attribute__ ((warn_unused_result)); | ||
3002 | |||
3003 | int property_start_tag (XML_Parser xmlp, const char *tag, | ||
3004 | char * const *attr) | ||
3005 | @@ -88,7 +88,7 @@ | ||
3006 | NihList *prototypes, | ||
3007 | NihList *handlers, | ||
3008 | NihList *structs) | ||
3009 | - __attribute__ ((warn_unused_result, malloc)); | ||
3010 | + __attribute__ ((warn_unused_result)); | ||
3011 | char * property_object_set_function (const void *parent, | ||
3012 | const char *prefix, | ||
3013 | Interface *interface, | ||
3014 | @@ -96,7 +96,7 @@ | ||
3015 | NihList *prototypes, | ||
3016 | NihList *handlers, | ||
3017 | NihList *structs) | ||
3018 | - __attribute__ ((warn_unused_result, malloc)); | ||
3019 | + __attribute__ ((warn_unused_result)); | ||
3020 | |||
3021 | char * property_proxy_get_function (const void *parent, | ||
3022 | const char *prefix, | ||
3023 | @@ -104,7 +104,7 @@ | ||
3024 | Property *property, | ||
3025 | NihList *prototypes, | ||
3026 | NihList *structs) | ||
3027 | - __attribute__ ((warn_unused_result, malloc)); | ||
3028 | + __attribute__ ((warn_unused_result)); | ||
3029 | char * property_proxy_get_notify_function (const void *parent, | ||
3030 | const char *prefix, | ||
3031 | Interface *interface, | ||
3032 | @@ -112,7 +112,7 @@ | ||
3033 | NihList *prototypes, | ||
3034 | NihList *typedefs, | ||
3035 | NihList *structs) | ||
3036 | - __attribute__ ((warn_unused_result, malloc)); | ||
3037 | + __attribute__ ((warn_unused_result)); | ||
3038 | |||
3039 | char * property_proxy_set_function (const void *parent, | ||
3040 | const char *prefix, | ||
3041 | @@ -120,7 +120,7 @@ | ||
3042 | Property *property, | ||
3043 | NihList *prototypes, | ||
3044 | NihList *structs) | ||
3045 | - __attribute__ ((warn_unused_result, malloc)); | ||
3046 | + __attribute__ ((warn_unused_result)); | ||
3047 | char * property_proxy_set_notify_function (const void *parent, | ||
3048 | const char *prefix, | ||
3049 | Interface *interface, | ||
3050 | @@ -128,7 +128,7 @@ | ||
3051 | NihList *prototypes, | ||
3052 | NihList *typedefs, | ||
3053 | NihList *structs) | ||
3054 | - __attribute__ ((warn_unused_result, malloc)); | ||
3055 | + __attribute__ ((warn_unused_result)); | ||
3056 | |||
3057 | char * property_proxy_get_sync_function (const void *parent, | ||
3058 | const char *prefix, | ||
3059 | @@ -136,14 +136,14 @@ | ||
3060 | Property *property, | ||
3061 | NihList *prototypes, | ||
3062 | NihList *structs) | ||
3063 | - __attribute__ ((warn_unused_result, malloc)); | ||
3064 | + __attribute__ ((warn_unused_result)); | ||
3065 | char * property_proxy_set_sync_function (const void *parent, | ||
3066 | const char *prefix, | ||
3067 | Interface *interface, | ||
3068 | Property *property, | ||
3069 | NihList *prototypes, | ||
3070 | NihList *structs) | ||
3071 | - __attribute__ ((warn_unused_result, malloc)); | ||
3072 | + __attribute__ ((warn_unused_result)); | ||
3073 | |||
3074 | NIH_END_EXTERN | ||
3075 | |||
3076 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_main.c | ||
3077 | +++ libnih-1.0.3/nih-dbus-tool/tests/test_main.c | ||
3078 | @@ -100,10 +100,10 @@ | ||
3079 | |||
3080 | extern char *source_file_path (const void *parent, const char *output_path, | ||
3081 | const char *filename) | ||
3082 | - __attribute__ ((warn_unused_result, malloc)); | ||
3083 | + __attribute__ ((warn_unused_result)); | ||
3084 | extern char *header_file_path (const void *parent, const char *output_path, | ||
3085 | const char *filename) | ||
3086 | - __attribute__ ((warn_unused_result, malloc)); | ||
3087 | + __attribute__ ((warn_unused_result)); | ||
3088 | |||
3089 | void | ||
3090 | test_source_file_path (void) | ||
3091 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c | ||
3092 | +++ libnih-1.0.3/nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c | ||
3093 | @@ -12524,6 +12524,7 @@ | ||
3094 | dbus_message_iter_init (reply, &iter); | ||
3095 | |||
3096 | dbus_message_iter_get_basic (&iter, &str_value); | ||
3097 | + TEST_NE (str_value[0], '\0'); | ||
3098 | TEST_TRUE (strchr ("0123456789", str_value[0])); | ||
3099 | |||
3100 | dbus_message_unref (reply); | ||
3101 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_marshal.c | ||
3102 | +++ libnih-1.0.3/nih-dbus-tool/tests/test_marshal.c | ||
3103 | @@ -1479,39 +1479,41 @@ | ||
3104 | "\treturn -1;\n" | ||
3105 | "}\n" | ||
3106 | "\n" | ||
3107 | - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3108 | - "\tDBusMessageIter value_element_iter;\n" | ||
3109 | - "\tconst int16_t * value_element;\n" | ||
3110 | - "\tsize_t value_element_len;\n" | ||
3111 | + "if (value) {\n" | ||
3112 | + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3113 | + "\t\tDBusMessageIter value_element_iter;\n" | ||
3114 | + "\t\tconst int16_t * value_element;\n" | ||
3115 | + "\t\tsize_t value_element_len;\n" | ||
3116 | "\n" | ||
3117 | - "\tvalue_element = value[value_i];\n" | ||
3118 | - "\tvalue_element_len = value_len[value_i];\n" | ||
3119 | + "\t\tvalue_element = value[value_i];\n" | ||
3120 | + "\t\tvalue_element_len = value_len[value_i];\n" | ||
3121 | "\n" | ||
3122 | |||
3123 | - "\t/* Marshal an array onto the message */\n" | ||
3124 | - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"n\", &value_element_iter)) {\n" | ||
3125 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3126 | - "\t\treturn -1;\n" | ||
3127 | - "\t}\n" | ||
3128 | + "\t\t/* Marshal an array onto the message */\n" | ||
3129 | + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"n\", &value_element_iter)) {\n" | ||
3130 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3131 | + "\t\t\treturn -1;\n" | ||
3132 | + "\t\t}\n" | ||
3133 | "\n" | ||
3134 | - "\tfor (size_t value_element_i = 0; value_element_i < value_element_len; value_element_i++) {\n" | ||
3135 | - "\t\tint16_t value_element_element;\n" | ||
3136 | + "\t\tfor (size_t value_element_i = 0; value_element_i < value_element_len; value_element_i++) {\n" | ||
3137 | + "\t\t\tint16_t value_element_element;\n" | ||
3138 | "\n" | ||
3139 | - "\t\tvalue_element_element = value_element[value_element_i];\n" | ||
3140 | + "\t\t\tvalue_element_element = value_element[value_element_i];\n" | ||
3141 | "\n" | ||
3142 | - "\t\t/* Marshal a int16_t onto the message */\n" | ||
3143 | - "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_INT16, &value_element_element)) {\n" | ||
3144 | - "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3145 | + "\t\t\t/* Marshal a int16_t onto the message */\n" | ||
3146 | + "\t\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_INT16, &value_element_element)) {\n" | ||
3147 | + "\t\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3148 | + "\t\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3149 | + "\t\t\t\treturn -1;\n" | ||
3150 | + "\t\t\t}\n" | ||
3151 | + "\t\t}\n" | ||
3152 | + "\n" | ||
3153 | + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3154 | "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3155 | "\t\t\treturn -1;\n" | ||
3156 | "\t\t}\n" | ||
3157 | - "\t}\n" | ||
3158 | - "\n" | ||
3159 | - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3160 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3161 | - "\t\treturn -1;\n" | ||
3162 | - "\t}\n" | ||
3163 | |||
3164 | + "\t}\n" | ||
3165 | "}\n" | ||
3166 | "\n" | ||
3167 | "if (! dbus_message_iter_close_container (&iter, &value_iter)) {\n" | ||
3168 | @@ -1766,15 +1768,17 @@ | ||
3169 | "\treturn -1;\n" | ||
3170 | "}\n" | ||
3171 | "\n" | ||
3172 | - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3173 | - "\tconst char *value_element;\n" | ||
3174 | + "if (value) {\n" | ||
3175 | + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3176 | + "\t\tconst char *value_element;\n" | ||
3177 | "\n" | ||
3178 | - "\tvalue_element = value[value_i];\n" | ||
3179 | + "\t\tvalue_element = value[value_i];\n" | ||
3180 | "\n" | ||
3181 | - "\t/* Marshal a char * onto the message */\n" | ||
3182 | - "\tif (! dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &value_element)) {\n" | ||
3183 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3184 | - "\t\treturn -1;\n" | ||
3185 | + "\t\t/* Marshal a char * onto the message */\n" | ||
3186 | + "\t\tif (! dbus_message_iter_append_basic (&value_iter, DBUS_TYPE_STRING, &value_element)) {\n" | ||
3187 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3188 | + "\t\t\treturn -1;\n" | ||
3189 | + "\t\t}\n" | ||
3190 | "\t}\n" | ||
3191 | "}\n" | ||
3192 | "\n" | ||
3193 | @@ -1933,35 +1937,39 @@ | ||
3194 | "\treturn -1;\n" | ||
3195 | "}\n" | ||
3196 | "\n" | ||
3197 | - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3198 | - "\tDBusMessageIter value_element_iter;\n" | ||
3199 | - "\tchar * const * value_element;\n" | ||
3200 | + "if (value) {\n" | ||
3201 | + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3202 | + "\t\tDBusMessageIter value_element_iter;\n" | ||
3203 | + "\t\tchar * const * value_element;\n" | ||
3204 | "\n" | ||
3205 | - "\tvalue_element = value[value_i];\n" | ||
3206 | + "\t\tvalue_element = value[value_i];\n" | ||
3207 | "\n" | ||
3208 | - "\t/* Marshal an array onto the message */\n" | ||
3209 | - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"s\", &value_element_iter)) {\n" | ||
3210 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3211 | - "\t\treturn -1;\n" | ||
3212 | - "\t}\n" | ||
3213 | - "\n" | ||
3214 | - "\tfor (size_t value_element_i = 0; value_element[value_element_i]; value_element_i++) {\n" | ||
3215 | - "\t\tconst char *value_element_element;\n" | ||
3216 | + "\t\t/* Marshal an array onto the message */\n" | ||
3217 | + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_ARRAY, \"s\", &value_element_iter)) {\n" | ||
3218 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3219 | + "\t\t\treturn -1;\n" | ||
3220 | + "\t\t}\n" | ||
3221 | "\n" | ||
3222 | - "\t\tvalue_element_element = value_element[value_element_i];\n" | ||
3223 | + "\t\tif (value_element) {\n" | ||
3224 | + "\t\t\tfor (size_t value_element_i = 0; value_element[value_element_i]; value_element_i++) {\n" | ||
3225 | + "\t\t\t\tconst char *value_element_element;\n" | ||
3226 | + "\n" | ||
3227 | + "\t\t\t\tvalue_element_element = value_element[value_element_i];\n" | ||
3228 | + "\n" | ||
3229 | + "\t\t\t\t/* Marshal a char * onto the message */\n" | ||
3230 | + "\t\t\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_element)) {\n" | ||
3231 | + "\t\t\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3232 | + "\t\t\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3233 | + "\t\t\t\t\treturn -1;\n" | ||
3234 | + "\t\t\t\t}\n" | ||
3235 | + "\t\t\t}\n" | ||
3236 | + "\t\t}\n" | ||
3237 | "\n" | ||
3238 | - "\t\t/* Marshal a char * onto the message */\n" | ||
3239 | - "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_element)) {\n" | ||
3240 | - "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3241 | + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3242 | "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3243 | "\t\t\treturn -1;\n" | ||
3244 | "\t\t}\n" | ||
3245 | "\t}\n" | ||
3246 | - "\n" | ||
3247 | - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3248 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3249 | - "\t\treturn -1;\n" | ||
3250 | - "\t}\n" | ||
3251 | "}\n" | ||
3252 | "\n" | ||
3253 | "if (! dbus_message_iter_close_container (&iter, &value_iter)) {\n" | ||
3254 | @@ -2194,16 +2202,18 @@ | ||
3255 | "\treturn -1;\n" | ||
3256 | "}\n" | ||
3257 | "\n" | ||
3258 | - "for (size_t value_item2_i = 0; value_item2[value_item2_i]; value_item2_i++) {\n" | ||
3259 | - "\tconst char *value_item2_element;\n" | ||
3260 | + "if (value_item2) {\n" | ||
3261 | + "\tfor (size_t value_item2_i = 0; value_item2[value_item2_i]; value_item2_i++) {\n" | ||
3262 | + "\t\tconst char *value_item2_element;\n" | ||
3263 | "\n" | ||
3264 | - "\tvalue_item2_element = value_item2[value_item2_i];\n" | ||
3265 | + "\t\tvalue_item2_element = value_item2[value_item2_i];\n" | ||
3266 | "\n" | ||
3267 | - "\t/* Marshal a char * onto the message */\n" | ||
3268 | - "\tif (! dbus_message_iter_append_basic (&value_item2_iter, DBUS_TYPE_STRING, &value_item2_element)) {\n" | ||
3269 | - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_item2_iter);\n" | ||
3270 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3271 | - "\t\treturn -1;\n" | ||
3272 | + "\t\t/* Marshal a char * onto the message */\n" | ||
3273 | + "\t\tif (! dbus_message_iter_append_basic (&value_item2_iter, DBUS_TYPE_STRING, &value_item2_element)) {\n" | ||
3274 | + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_item2_iter);\n" | ||
3275 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3276 | + "\t\t\treturn -1;\n" | ||
3277 | + "\t\t}\n" | ||
3278 | "\t}\n" | ||
3279 | "}\n" | ||
3280 | "\n" | ||
3281 | @@ -2642,41 +2652,43 @@ | ||
3282 | "\treturn -1;\n" | ||
3283 | "}\n" | ||
3284 | "\n" | ||
3285 | - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3286 | - "\tDBusMessageIter value_element_iter;\n" | ||
3287 | - "\tconst char * value_element_item0;\n" | ||
3288 | - "\tuint32_t value_element_item1;\n" | ||
3289 | - "\tconst MyStructArrayValueElement *value_element;\n" | ||
3290 | + "if (value) {\n" | ||
3291 | + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3292 | + "\t\tDBusMessageIter value_element_iter;\n" | ||
3293 | + "\t\tconst char * value_element_item0;\n" | ||
3294 | + "\t\tuint32_t value_element_item1;\n" | ||
3295 | + "\t\tconst MyStructArrayValueElement *value_element;\n" | ||
3296 | "\n" | ||
3297 | - "\tvalue_element = value[value_i];\n" | ||
3298 | + "\t\tvalue_element = value[value_i];\n" | ||
3299 | "\n" | ||
3300 | - "\t/* Marshal a structure onto the message */\n" | ||
3301 | - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_STRUCT, NULL, &value_element_iter)) {\n" | ||
3302 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3303 | - "\t\treturn -1;\n" | ||
3304 | - "\t}\n" | ||
3305 | + "\t\t/* Marshal a structure onto the message */\n" | ||
3306 | + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_STRUCT, NULL, &value_element_iter)) {\n" | ||
3307 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3308 | + "\t\t\treturn -1;\n" | ||
3309 | + "\t\t}\n" | ||
3310 | "\n" | ||
3311 | - "\tvalue_element_item0 = value_element->item0;\n" | ||
3312 | + "\t\tvalue_element_item0 = value_element->item0;\n" | ||
3313 | "\n" | ||
3314 | - "\t/* Marshal a char * onto the message */\n" | ||
3315 | - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" | ||
3316 | - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3317 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3318 | - "\t\treturn -1;\n" | ||
3319 | - "\t}\n" | ||
3320 | + "\t\t/* Marshal a char * onto the message */\n" | ||
3321 | + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" | ||
3322 | + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3323 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3324 | + "\t\t\treturn -1;\n" | ||
3325 | + "\t\t}\n" | ||
3326 | "\n" | ||
3327 | - "\tvalue_element_item1 = value_element->item1;\n" | ||
3328 | + "\t\tvalue_element_item1 = value_element->item1;\n" | ||
3329 | "\n" | ||
3330 | - "\t/* Marshal a uint32_t onto the message */\n" | ||
3331 | - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" | ||
3332 | - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3333 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3334 | - "\t\treturn -1;\n" | ||
3335 | - "\t}\n" | ||
3336 | + "\t\t/* Marshal a uint32_t onto the message */\n" | ||
3337 | + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" | ||
3338 | + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3339 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3340 | + "\t\t\treturn -1;\n" | ||
3341 | + "\t\t}\n" | ||
3342 | "\n" | ||
3343 | - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3344 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3345 | - "\t\treturn -1;\n" | ||
3346 | + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3347 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3348 | + "\t\t\treturn -1;\n" | ||
3349 | + "\t\t}\n" | ||
3350 | "\t}\n" | ||
3351 | "}\n" | ||
3352 | "\n" | ||
3353 | @@ -2912,41 +2924,43 @@ | ||
3354 | "\treturn -1;\n" | ||
3355 | "}\n" | ||
3356 | "\n" | ||
3357 | - "for (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3358 | - "\tDBusMessageIter value_element_iter;\n" | ||
3359 | - "\tconst char * value_element_item0;\n" | ||
3360 | - "\tuint32_t value_element_item1;\n" | ||
3361 | - "\tconst MyDictEntryArrayValueElement *value_element;\n" | ||
3362 | + "if (value) {\n" | ||
3363 | + "\tfor (size_t value_i = 0; value[value_i]; value_i++) {\n" | ||
3364 | + "\t\tDBusMessageIter value_element_iter;\n" | ||
3365 | + "\t\tconst char * value_element_item0;\n" | ||
3366 | + "\t\tuint32_t value_element_item1;\n" | ||
3367 | + "\t\tconst MyDictEntryArrayValueElement *value_element;\n" | ||
3368 | "\n" | ||
3369 | - "\tvalue_element = value[value_i];\n" | ||
3370 | + "\t\tvalue_element = value[value_i];\n" | ||
3371 | "\n" | ||
3372 | - "\t/* Marshal a structure onto the message */\n" | ||
3373 | - "\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_DICT_ENTRY, NULL, &value_element_iter)) {\n" | ||
3374 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3375 | - "\t\treturn -1;\n" | ||
3376 | - "\t}\n" | ||
3377 | + "\t\t/* Marshal a structure onto the message */\n" | ||
3378 | + "\t\tif (! dbus_message_iter_open_container (&value_iter, DBUS_TYPE_DICT_ENTRY, NULL, &value_element_iter)) {\n" | ||
3379 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3380 | + "\t\t\treturn -1;\n" | ||
3381 | + "\t\t}\n" | ||
3382 | "\n" | ||
3383 | - "\tvalue_element_item0 = value_element->item0;\n" | ||
3384 | + "\t\tvalue_element_item0 = value_element->item0;\n" | ||
3385 | "\n" | ||
3386 | - "\t/* Marshal a char * onto the message */\n" | ||
3387 | - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" | ||
3388 | - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3389 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3390 | - "\t\treturn -1;\n" | ||
3391 | - "\t}\n" | ||
3392 | + "\t\t/* Marshal a char * onto the message */\n" | ||
3393 | + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_STRING, &value_element_item0)) {\n" | ||
3394 | + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3395 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3396 | + "\t\t\treturn -1;\n" | ||
3397 | + "\t\t}\n" | ||
3398 | "\n" | ||
3399 | - "\tvalue_element_item1 = value_element->item1;\n" | ||
3400 | + "\t\tvalue_element_item1 = value_element->item1;\n" | ||
3401 | "\n" | ||
3402 | - "\t/* Marshal a uint32_t onto the message */\n" | ||
3403 | - "\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" | ||
3404 | - "\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3405 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3406 | - "\t\treturn -1;\n" | ||
3407 | - "\t}\n" | ||
3408 | + "\t\t/* Marshal a uint32_t onto the message */\n" | ||
3409 | + "\t\tif (! dbus_message_iter_append_basic (&value_element_iter, DBUS_TYPE_UINT32, &value_element_item1)) {\n" | ||
3410 | + "\t\t\tdbus_message_iter_abandon_container (&value_iter, &value_element_iter);\n" | ||
3411 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3412 | + "\t\t\treturn -1;\n" | ||
3413 | + "\t\t}\n" | ||
3414 | "\n" | ||
3415 | - "\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3416 | - "\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3417 | - "\t\treturn -1;\n" | ||
3418 | + "\t\tif (! dbus_message_iter_close_container (&value_iter, &value_element_iter)) {\n" | ||
3419 | + "\t\t\tdbus_message_iter_abandon_container (&iter, &value_iter);\n" | ||
3420 | + "\t\t\treturn -1;\n" | ||
3421 | + "\t\t}\n" | ||
3422 | "\t}\n" | ||
3423 | "}\n" | ||
3424 | "\n" | ||
3425 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c | ||
3426 | +++ libnih-1.0.3/nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c | ||
3427 | @@ -27359,6 +27359,7 @@ | ||
3428 | TEST_TRUE (unix_fd_to_str_replied); | ||
3429 | |||
3430 | TEST_EQ_P (last_data, parent); | ||
3431 | + TEST_NE (last_str_value[0], '\0'); | ||
3432 | TEST_TRUE (strchr ("0123456789", last_str_value[0])); | ||
3433 | TEST_ALLOC_PARENT (last_str_value, parent); | ||
3434 | |||
3435 | @@ -27673,6 +27674,7 @@ | ||
3436 | |||
3437 | TEST_EQ (ret, 0); | ||
3438 | |||
3439 | + TEST_NE (str_value[0], '\0'); | ||
3440 | TEST_TRUE (strchr ("0123456789", str_value[0])); | ||
3441 | TEST_ALLOC_PARENT (str_value, parent); | ||
3442 | |||
3443 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/test_property.c | ||
3444 | +++ libnih-1.0.3/nih-dbus-tool/tests/test_property.c | ||
3445 | @@ -8733,7 +8733,7 @@ | ||
3446 | TypeVar * var; | ||
3447 | NihListEntry * attrib; | ||
3448 | NihDBusProxy * proxy = NULL; | ||
3449 | - void * parent = NULL; | ||
3450 | + void * parent __attribute__((unused)) = NULL; | ||
3451 | pid_t pid = -1; | ||
3452 | int status; | ||
3453 | DBusMessage * method_call; | ||
3454 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_object_function_standard.c | ||
3455 | +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_object_function_standard.c | ||
3456 | @@ -136,17 +136,19 @@ | ||
3457 | goto enomem; | ||
3458 | } | ||
3459 | |||
3460 | - for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3461 | - const char *output_element; | ||
3462 | + if (output) { | ||
3463 | + for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3464 | + const char *output_element; | ||
3465 | |||
3466 | - output_element = output[output_i]; | ||
3467 | + output_element = output[output_i]; | ||
3468 | |||
3469 | - /* Marshal a char * onto the message */ | ||
3470 | - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3471 | - dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3472 | - dbus_message_unref (reply); | ||
3473 | - reply = NULL; | ||
3474 | - goto enomem; | ||
3475 | + /* Marshal a char * onto the message */ | ||
3476 | + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3477 | + dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3478 | + dbus_message_unref (reply); | ||
3479 | + reply = NULL; | ||
3480 | + goto enomem; | ||
3481 | + } | ||
3482 | } | ||
3483 | } | ||
3484 | |||
3485 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_reply_function_standard.c | ||
3486 | +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_reply_function_standard.c | ||
3487 | @@ -7,7 +7,6 @@ | ||
3488 | DBusMessageIter output_iter; | ||
3489 | |||
3490 | nih_assert (message != NULL); | ||
3491 | - nih_assert (output != NULL); | ||
3492 | |||
3493 | /* If the sender doesn't care about a reply, don't bother wasting | ||
3494 | * effort constructing and sending one. | ||
3495 | @@ -28,16 +27,18 @@ | ||
3496 | return -1; | ||
3497 | } | ||
3498 | |||
3499 | - for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3500 | - const char *output_element; | ||
3501 | - | ||
3502 | - output_element = output[output_i]; | ||
3503 | - | ||
3504 | - /* Marshal a char * onto the message */ | ||
3505 | - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3506 | - dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3507 | - dbus_message_unref (reply); | ||
3508 | - return -1; | ||
3509 | + if (output) { | ||
3510 | + for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3511 | + const char *output_element; | ||
3512 | + | ||
3513 | + output_element = output[output_i]; | ||
3514 | + | ||
3515 | + /* Marshal a char * onto the message */ | ||
3516 | + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3517 | + dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3518 | + dbus_message_unref (reply); | ||
3519 | + return -1; | ||
3520 | + } | ||
3521 | } | ||
3522 | } | ||
3523 | |||
3524 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_reply_function_deprecated.c | ||
3525 | +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_reply_function_deprecated.c | ||
3526 | @@ -7,7 +7,6 @@ | ||
3527 | DBusMessageIter output_iter; | ||
3528 | |||
3529 | nih_assert (message != NULL); | ||
3530 | - nih_assert (output != NULL); | ||
3531 | |||
3532 | /* If the sender doesn't care about a reply, don't bother wasting | ||
3533 | * effort constructing and sending one. | ||
3534 | @@ -28,16 +27,18 @@ | ||
3535 | return -1; | ||
3536 | } | ||
3537 | |||
3538 | - for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3539 | - const char *output_element; | ||
3540 | - | ||
3541 | - output_element = output[output_i]; | ||
3542 | - | ||
3543 | - /* Marshal a char * onto the message */ | ||
3544 | - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3545 | - dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3546 | - dbus_message_unref (reply); | ||
3547 | - return -1; | ||
3548 | + if (output) { | ||
3549 | + for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3550 | + const char *output_element; | ||
3551 | + | ||
3552 | + output_element = output[output_i]; | ||
3553 | + | ||
3554 | + /* Marshal a char * onto the message */ | ||
3555 | + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3556 | + dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3557 | + dbus_message_unref (reply); | ||
3558 | + return -1; | ||
3559 | + } | ||
3560 | } | ||
3561 | } | ||
3562 | |||
3563 | --- libnih-1.0.3.orig/nih-dbus-tool/tests/expected/test_method_object_function_no_input.c | ||
3564 | +++ libnih-1.0.3/nih-dbus-tool/tests/expected/test_method_object_function_no_input.c | ||
3565 | @@ -88,17 +88,19 @@ | ||
3566 | goto enomem; | ||
3567 | } | ||
3568 | |||
3569 | - for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3570 | - const char *output_element; | ||
3571 | + if (output) { | ||
3572 | + for (size_t output_i = 0; output[output_i]; output_i++) { | ||
3573 | + const char *output_element; | ||
3574 | |||
3575 | - output_element = output[output_i]; | ||
3576 | + output_element = output[output_i]; | ||
3577 | |||
3578 | - /* Marshal a char * onto the message */ | ||
3579 | - if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3580 | - dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3581 | - dbus_message_unref (reply); | ||
3582 | - reply = NULL; | ||
3583 | - goto enomem; | ||
3584 | + /* Marshal a char * onto the message */ | ||
3585 | + if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_STRING, &output_element)) { | ||
3586 | + dbus_message_iter_abandon_container (&iter, &output_iter); | ||
3587 | + dbus_message_unref (reply); | ||
3588 | + reply = NULL; | ||
3589 | + goto enomem; | ||
3590 | + } | ||
3591 | } | ||
3592 | } | ||
3593 | |||
diff --git a/meta-oe/recipes-support/libnih/libnih_1.0.3.bb b/meta-oe/recipes-support/libnih/libnih_1.0.3.bb new file mode 100644 index 0000000000..97385a1c0a --- /dev/null +++ b/meta-oe/recipes-support/libnih/libnih_1.0.3.bb | |||
@@ -0,0 +1,38 @@ | |||
1 | # Copyright (c) 2013 LG Electronics, Inc. | ||
2 | |||
3 | SUMMARY = "libnih library" | ||
4 | DESCRIPTION = "libnih is a small library for C application development \ | ||
5 | containing functions that, despite its name, are not implemented \ | ||
6 | elsewhere in the standard library set. \ | ||
7 | \ | ||
8 | libnih is roughly equivalent to other C libraries such as glib, \ | ||
9 | except that its focus is on a small size and intended for \ | ||
10 | applications that sit very low in the software stack, especially \ | ||
11 | outside of /usr. \ | ||
12 | \ | ||
13 | It expressly does not reimplement functions that already exist in \ | ||
14 | libraries ordinarily shipped in /lib such libc6, and does not do \ | ||
15 | foolish things like invent arbitrary typedefs for perfectly good C types." | ||
16 | |||
17 | SECTION = "libs" | ||
18 | |||
19 | LICENSE = "GPL-2.0" | ||
20 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | ||
21 | |||
22 | DEPENDS = "dbus libnih-native" | ||
23 | DEPENDS_class-native = "dbus-native" | ||
24 | |||
25 | PR = "r0" | ||
26 | |||
27 | SRC_URI = "https://launchpad.net/${BPN}/1.0/${PV}/+download/${BP}.tar.gz \ | ||
28 | file://libnih_1.0.3-4ubuntu16.patch \ | ||
29 | " | ||
30 | |||
31 | SRC_URI[md5sum] = "db7990ce55e01daffe19006524a1ccb0" | ||
32 | SRC_URI[sha256sum] = "897572df7565c0a90a81532671e23c63f99b4efde2eecbbf11e7857fbc61f405" | ||
33 | |||
34 | inherit autotools | ||
35 | inherit gettext | ||
36 | |||
37 | # target libnih requires native nih-dbus-tool | ||
38 | BBCLASSEXTEND = "native" | ||