0001-Implicit-builtin-functions.patch 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. From 429d031edd52566eeba03c3b3af32ad6e103fd94 Mon Sep 17 00:00:00 2001
  2. From: Steve Grubb <[email protected]>
  3. Date: Fri, 3 May 2024 17:33:39 -0400
  4. Subject: [PATCH] Implicit builtin functions
  5. Correct a number of places where printf is being used without a prototype.
  6. All cases are in libraries which should not be using printf. Change them
  7. to return an error rather than communicate the problem.
  8. This is a backport of 8c7eaa7
  9. ---
  10. audisp/audispd-llist.c | 10 +++++-----
  11. audisp/audispd-llist.h | 4 ++--
  12. auparse/normalize-llist.c | 12 ++++++------
  13. auparse/normalize-llist.h | 4 ++--
  14. auparse/normalize.c | 14 +++++++++-----
  15. src/auditctl-llist.c | 18 +++++++++---------
  16. src/auditctl-llist.h | 4 ++--
  17. src/ausearch-avc.c | 16 ++++++++--------
  18. src/ausearch-avc.h | 4 ++--
  19. src/ausearch-int.c | 12 ++++++------
  20. src/ausearch-int.h | 4 ++--
  21. src/ausearch-llist.c | 14 +++++++-------
  22. src/ausearch-llist.h | 2 +-
  23. src/ausearch-nvpair.c | 12 ++++++------
  24. src/ausearch-nvpair.h | 4 ++--
  25. src/ausearch-string.c | 10 +++++-----
  26. src/ausearch-string.h | 2 +-
  27. tools/aulastlog/aulastlog-llist.c | 18 +++++++++---------
  28. tools/aulastlog/aulastlog-llist.h | 4 ++--
  29. 19 files changed, 86 insertions(+), 82 deletions(-)
  30. --- a/audisp/audispd-llist.c
  31. +++ b/audisp/audispd-llist.c
  32. @@ -69,15 +69,13 @@ unsigned int plist_count_active(const co
  33. return cnt;
  34. }
  35. -void plist_append(conf_llist *l, plugin_conf_t *p)
  36. +int plist_append(conf_llist *l, plugin_conf_t *p)
  37. {
  38. lnode* newnode;
  39. newnode = malloc(sizeof(lnode));
  40. - if (newnode == NULL) {
  41. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  42. - return;
  43. - }
  44. + if (newnode == NULL)
  45. + return 1;
  46. if (p) {
  47. void *pp = malloc(sizeof(struct plugin_conf));
  48. @@ -98,6 +96,8 @@ void plist_append(conf_llist *l, plugin_
  49. // make newnode current
  50. l->cur = newnode;
  51. l->cnt++;
  52. +
  53. + return 0;
  54. }
  55. void plist_clear(conf_llist* l)
  56. --- a/audisp/audispd-llist.h
  57. +++ b/audisp/audispd-llist.h
  58. @@ -1,6 +1,6 @@
  59. /*
  60. * audispd-llist.h - Header file for ausearch-conf_llist.c
  61. -* Copyright (c) 2007,2013 Red Hat Inc., Durham, North Carolina.
  62. +* Copyright (c) 2007,2013 Red Hat Inc.
  63. * All Rights Reserved.
  64. *
  65. * This software may be freely redistributed and/or modified under the
  66. @@ -51,7 +51,7 @@ unsigned int plist_count_active(const co
  67. void plist_last(conf_llist *l);
  68. lnode *plist_next(conf_llist *l);
  69. static inline lnode *plist_get_cur(conf_llist *l) { return l->cur; }
  70. -void plist_append(conf_llist *l, plugin_conf_t *p);
  71. +int plist_append(conf_llist *l, plugin_conf_t *p);
  72. void plist_clear(conf_llist* l);
  73. void plist_mark_all_unchecked(conf_llist* l);
  74. lnode *plist_find_unchecked(conf_llist* l);
  75. --- a/auparse/normalize-llist.c
  76. +++ b/auparse/normalize-llist.c
  77. @@ -1,6 +1,6 @@
  78. /*
  79. * normalize-llist.c - Minimal linked list library
  80. - * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina.
  81. + * Copyright (c) 2016-17 Red Hat Inc.
  82. * All Rights Reserved.
  83. *
  84. * This library is free software; you can redistribute it and/or
  85. @@ -61,15 +61,14 @@ data_node *cllist_next(cllist *l)
  86. return l->cur;
  87. }
  88. -void cllist_append(cllist *l, uint32_t num, void *data)
  89. +// Returns 0 on success and 1 on error
  90. +int cllist_append(cllist *l, uint32_t num, void *data)
  91. {
  92. data_node *newnode;
  93. newnode = malloc(sizeof(data_node));
  94. - if (newnode == NULL) {
  95. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  96. - return;
  97. - }
  98. + if (newnode == NULL)
  99. + return 1;
  100. newnode->num = num;
  101. newnode->data = data;
  102. @@ -84,5 +83,6 @@ void cllist_append(cllist *l, uint32_t n
  103. // make newnode current
  104. l->cur = newnode;
  105. l->cnt++;
  106. + return 0;
  107. }
  108. --- a/auparse/normalize-llist.h
  109. +++ b/auparse/normalize-llist.h
  110. @@ -1,6 +1,6 @@
  111. /*
  112. * normalize-llist.h - Header file for normalize-llist.c
  113. - * Copyright (c) 2016-17 Red Hat Inc., Durham, North Carolina.
  114. + * Copyright (c) 2016-17 Red Hat Inc.
  115. * All Rights Reserved.
  116. *
  117. * This library is free software; you can redistribute it and/or
  118. @@ -53,7 +53,7 @@ AUDIT_HIDDEN_START
  119. void cllist_create(cllist *l, void (*cleanup)(void *));
  120. void cllist_clear(cllist* l);
  121. data_node *cllist_next(cllist *l);
  122. -void cllist_append(cllist *l, uint32_t num, void *data);
  123. +int cllist_append(cllist *l, uint32_t num, void *data);
  124. AUDIT_HIDDEN_END
  125. --- a/auparse/normalize.c
  126. +++ b/auparse/normalize.c
  127. @@ -179,7 +179,8 @@ static unsigned int add_subj_attr(aupars
  128. if ((auparse_find_field(au, str))) {
  129. attr = set_record(0, rnum);
  130. attr = set_field(attr, auparse_get_field_num(au));
  131. - cllist_append(&D.actor.attr, attr, NULL);
  132. + if (cllist_append(&D.actor.attr, attr, NULL))
  133. + return 1;
  134. return 0;
  135. } else
  136. auparse_goto_record_num(au, rnum);
  137. @@ -224,7 +225,8 @@ static unsigned int add_obj_attr(auparse
  138. if ((auparse_find_field(au, str))) {
  139. attr = set_record(0, rnum);
  140. attr = set_field(attr, auparse_get_field_num(au));
  141. - cllist_append(&D.thing.attr, attr, NULL);
  142. + if (cllist_append(&D.thing.attr, attr, NULL))
  143. + return 1;
  144. return 0;
  145. } else
  146. auparse_goto_record_num(au, rnum);
  147. @@ -360,21 +362,23 @@ static void collect_id_obj2(auparse_stat
  148. }
  149. }
  150. -static void collect_path_attrs(auparse_state_t *au)
  151. +static int collect_path_attrs(auparse_state_t *au)
  152. {
  153. value_t attr;
  154. unsigned int rnum = auparse_get_record_num(au);
  155. auparse_first_field(au);
  156. if (add_obj_attr(au, "mode", rnum))
  157. - return; // Failed opens don't have anything else
  158. + return 1; // Failed opens don't have anything else
  159. // All the rest of the fields matter
  160. while ((auparse_next_field(au))) {
  161. attr = set_record(0, rnum);
  162. attr = set_field(attr, auparse_get_field_num(au));
  163. - cllist_append(&D.thing.attr, attr, NULL);
  164. + if (cllist_append(&D.thing.attr, attr, NULL))
  165. + return 1;
  166. }
  167. + return 0;
  168. }
  169. static void collect_cwd_attrs(auparse_state_t *au)
  170. --- a/src/auditctl-llist.c
  171. +++ b/src/auditctl-llist.c
  172. @@ -1,7 +1,7 @@
  173. /*
  174. * ausearch-llist.c - Minimal linked list library
  175. -* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina.
  176. -* All Rights Reserved.
  177. +* Copyright (c) 2005 Red Hat Inc.
  178. +* All Rights Reserved.
  179. *
  180. * This software may be freely redistributed and/or modified under the
  181. * terms of the GNU General Public License as published by the Free
  182. @@ -15,7 +15,7 @@
  183. *
  184. * You should have received a copy of the GNU General Public License
  185. * along with this program; see the file COPYING. If not, write to the
  186. -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  187. +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  188. * Boston, MA 02110-1335, USA.
  189. *
  190. * Authors:
  191. @@ -59,19 +59,17 @@ lnode *list_next(llist *l)
  192. return l->cur;
  193. }
  194. -void list_append(llist *l, struct audit_rule_data *r, size_t sz)
  195. +int list_append(llist *l, struct audit_rule_data *r, size_t sz)
  196. {
  197. lnode* newnode;
  198. newnode = malloc(sizeof(lnode));
  199. - if (newnode == NULL) {
  200. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  201. - return;
  202. - }
  203. + if (newnode == NULL)
  204. + return 1;
  205. if (r) {
  206. void *rr = malloc(sz);
  207. - if (rr)
  208. + if (rr)
  209. memcpy(rr, r, sz);
  210. newnode->r = rr;
  211. } else
  212. @@ -89,6 +87,8 @@ void list_append(llist *l, struct audit_
  213. // make newnode current
  214. l->cur = newnode;
  215. l->cnt++;
  216. +
  217. + return 0;
  218. }
  219. void list_clear(llist* l)
  220. --- a/src/auditctl-llist.h
  221. +++ b/src/auditctl-llist.h
  222. @@ -1,6 +1,6 @@
  223. /*
  224. * auditctl-llist.h - Header file for ausearch-llist.c
  225. -* Copyright (c) 2005 Red Hat Inc., Durham, North Carolina.
  226. +* Copyright (c) 2005 Red Hat Inc.
  227. * All Rights Reserved.
  228. *
  229. * This software may be freely redistributed and/or modified under the
  230. @@ -50,7 +50,7 @@ void list_first(llist *l);
  231. void list_last(llist *l);
  232. lnode *list_next(llist *l);
  233. static inline lnode *list_get_cur(llist *l) { return l->cur; }
  234. -void list_append(llist *l, struct audit_rule_data *r, size_t sz);
  235. +int list_append(llist *l, struct audit_rule_data *r, size_t sz);
  236. void list_clear(llist* l);
  237. #endif
  238. --- a/src/ausearch-avc.c
  239. +++ b/src/ausearch-avc.c
  240. @@ -1,7 +1,7 @@
  241. /*
  242. * ausearch-avc.c - Minimal linked list library for avcs
  243. -* Copyright (c) 2006,2008,2014 Red Hat Inc., Durham, North Carolina.
  244. -* All Rights Reserved.
  245. +* Copyright (c) 2006,2008,2014 Red Hat Inc.
  246. +* All Rights Reserved.
  247. *
  248. * This software may be freely redistributed and/or modified under the
  249. * terms of the GNU General Public License as published by the Free
  250. @@ -15,7 +15,7 @@
  251. *
  252. * You should have received a copy of the GNU General Public License
  253. * along with this program; see the file COPYING. If not, write to the
  254. -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  255. +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  256. * Boston, MA 02110-1335, USA.
  257. *
  258. * Authors:
  259. @@ -62,15 +62,13 @@ static void alist_last(alist *l)
  260. l->cur = cur;
  261. }
  262. -void alist_append(alist *l, anode *node)
  263. +int alist_append(alist *l, anode *node)
  264. {
  265. anode* newnode;
  266. newnode = malloc(sizeof(anode));
  267. - if (newnode == NULL) {
  268. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  269. - return;
  270. - }
  271. + if (newnode == NULL)
  272. + return 1;
  273. if (node->scontext)
  274. newnode->scontext = node->scontext;
  275. @@ -108,6 +106,8 @@ void alist_append(alist *l, anode *node)
  276. // make newnode current
  277. l->cur = newnode;
  278. l->cnt++;
  279. +
  280. + return 0;
  281. }
  282. int alist_find_subj(alist *l)
  283. --- a/src/ausearch-avc.h
  284. +++ b/src/ausearch-avc.h
  285. @@ -1,6 +1,6 @@
  286. /*
  287. * ausearch-avc.h - Header file for ausearch-string.c
  288. -* Copyright (c) 2006,2008 Red Hat Inc., Durham, North Carolina.
  289. +* Copyright (c) 2006,2008 Red Hat Inc.
  290. * All Rights Reserved.
  291. *
  292. * This software may be freely redistributed and/or modified under the
  293. @@ -54,7 +54,7 @@ void alist_create(alist *l);
  294. static inline void alist_first(alist *l) { l->cur = l->head; }
  295. anode *alist_next(alist *l);
  296. static inline anode *alist_get_cur(alist *l) { return l->cur; }
  297. -void alist_append(alist *l, anode *node);
  298. +int alist_append(alist *l, anode *node);
  299. void anode_init(anode *an);
  300. void anode_clear(anode *an);
  301. void alist_clear(alist* l);
  302. --- a/src/ausearch-int.c
  303. +++ b/src/ausearch-int.c
  304. @@ -1,6 +1,6 @@
  305. /*
  306. * ausearch-int.c - Minimal linked list library for integers
  307. -* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina.
  308. +* Copyright (c) 2005,2008 Red Hat Inc.
  309. * All Rights Reserved.
  310. *
  311. * This software may be freely redistributed and/or modified under the
  312. @@ -41,15 +41,13 @@ int_node *ilist_next(ilist *l)
  313. return l->cur;
  314. }
  315. -void ilist_append(ilist *l, int num, unsigned int hits, int aux)
  316. +int ilist_append(ilist *l, int num, unsigned int hits, int aux)
  317. {
  318. int_node* newnode;
  319. newnode = malloc(sizeof(int_node));
  320. - if (newnode == NULL) {
  321. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  322. - return;
  323. - }
  324. + if (newnode == NULL)
  325. + return 1;
  326. newnode->num = num;
  327. newnode->hits = hits;
  328. @@ -65,6 +63,8 @@ void ilist_append(ilist *l, int num, uns
  329. // make newnode current
  330. l->cur = newnode;
  331. l->cnt++;
  332. +
  333. + return 0;
  334. }
  335. void ilist_clear(ilist* l)
  336. --- a/src/ausearch-int.h
  337. +++ b/src/ausearch-int.h
  338. @@ -1,6 +1,6 @@
  339. /*
  340. * ausearch-int.h - Header file for ausearch-int.c
  341. -* Copyright (c) 2005,2008 Red Hat Inc., Durham, North Carolina.
  342. +* Copyright (c) 2005,2008 Red Hat Inc.
  343. * All Rights Reserved.
  344. *
  345. * This software may be freely redistributed and/or modified under the
  346. @@ -48,7 +48,7 @@ void ilist_create(ilist *l);
  347. static inline void ilist_first(ilist *l) { l->cur = l->head; }
  348. int_node *ilist_next(ilist *l);
  349. static inline int_node *ilist_get_cur(ilist *l) { return l->cur; }
  350. -void ilist_append(ilist *l, int num, unsigned int hits, int aux);
  351. +int ilist_append(ilist *l, int num, unsigned int hits, int aux);
  352. void ilist_clear(ilist* l);
  353. /* append a number if its not already on the list */
  354. --- a/src/ausearch-llist.c
  355. +++ b/src/ausearch-llist.c
  356. @@ -1,6 +1,6 @@
  357. /*
  358. * ausearch-llist.c - Minimal linked list library
  359. -* Copyright (c) 2005-2008,2011,2016 Red Hat Inc., Durham, North Carolina.
  360. +* Copyright (c) 2005-2008,2011,2016 Red Hat Inc.
  361. * Copyright (c) 2011 IBM Corp.
  362. * All Rights Reserved.
  363. *
  364. @@ -102,15 +102,13 @@ lnode *list_prev(llist *l)
  365. return l->cur;
  366. }
  367. -void list_append(llist *l, lnode *node)
  368. +int list_append(llist *l, lnode *node)
  369. {
  370. lnode* newnode;
  371. newnode = malloc(sizeof(lnode));
  372. - if (newnode == NULL) {
  373. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  374. - return;
  375. - }
  376. + if (newnode == NULL)
  377. + return 1;
  378. if (node->message)
  379. newnode->message = node->message;
  380. @@ -123,7 +121,7 @@ void list_append(llist *l, lnode *node)
  381. newnode->type = node->type;
  382. newnode->a0 = node->a0;
  383. newnode->a1 = node->a1;
  384. - newnode->item = l->cnt;
  385. + newnode->item = l->cnt;
  386. newnode->next = NULL;
  387. // if we are at top, fix this up
  388. @@ -135,6 +133,8 @@ void list_append(llist *l, lnode *node)
  389. // make newnode current
  390. l->cur = newnode;
  391. l->cnt++;
  392. +
  393. + return 0;
  394. }
  395. int list_find_item(llist *l, unsigned int i)
  396. --- a/src/ausearch-llist.h
  397. +++ b/src/ausearch-llist.h
  398. @@ -107,7 +107,7 @@ void list_last(llist *l);
  399. lnode *list_next(llist *l);
  400. lnode *list_prev(llist *l);
  401. static inline lnode *list_get_cur(llist *l) { return l->cur; }
  402. -void list_append(llist *l, lnode *node);
  403. +int list_append(llist *l, lnode *node);
  404. void list_clear(llist* l);
  405. int list_get_event(llist* l, event *e);
  406. --- a/src/ausearch-nvpair.c
  407. +++ b/src/ausearch-nvpair.c
  408. @@ -1,6 +1,6 @@
  409. /*
  410. * ausearch-nvpair.c - Minimal linked list library for name-value pairs
  411. -* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina.
  412. +* Copyright (c) 2006-08 Red Hat Inc.
  413. * All Rights Reserved.
  414. *
  415. * This software may be freely redistributed and/or modified under the
  416. @@ -42,13 +42,11 @@ nvnode *search_list_next(nvlist *l)
  417. return l->cur;
  418. }
  419. -void search_list_append(nvlist *l, nvnode *node)
  420. +int search_list_append(nvlist *l, nvnode *node)
  421. {
  422. nvnode* newnode = malloc(sizeof(nvnode));
  423. - if (newnode == NULL) {
  424. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  425. - return;
  426. - }
  427. + if (newnode == NULL)
  428. + return 1;
  429. newnode->name = node->name;
  430. newnode->val = node->val;
  431. @@ -66,6 +64,8 @@ void search_list_append(nvlist *l, nvnod
  432. // make newnode current
  433. l->cur = newnode;
  434. l->cnt++;
  435. +
  436. + return 0;
  437. }
  438. int search_list_find_val(nvlist *l, long val)
  439. --- a/src/ausearch-nvpair.h
  440. +++ b/src/ausearch-nvpair.h
  441. @@ -1,6 +1,6 @@
  442. /*
  443. * ausearch-nvpair.h - Header file for ausearch-nvpair.c
  444. -* Copyright (c) 2006-08 Red Hat Inc., Durham, North Carolina.
  445. +* Copyright (c) 2006-08 Red Hat Inc.
  446. * All Rights Reserved.
  447. *
  448. * This software may be freely redistributed and/or modified under the
  449. @@ -48,7 +48,7 @@ void search_list_create(nvlist *l);
  450. static inline void search_list_first(nvlist *l) { l->cur = l->head; }
  451. nvnode *search_list_next(nvlist *l);
  452. static inline nvnode *search_list_get_cur(nvlist *l) { return l->cur; }
  453. -void search_list_append(nvlist *l, nvnode *node);
  454. +int search_list_append(nvlist *l, nvnode *node);
  455. void search_list_clear(nvlist* l);
  456. /* Given a numeric index, find that record. */
  457. --- a/src/ausearch-string.c
  458. +++ b/src/ausearch-string.c
  459. @@ -44,15 +44,13 @@ snode *slist_next(slist *l)
  460. return l->cur;
  461. }
  462. -void slist_append(slist *l, snode *node)
  463. +int slist_append(slist *l, snode *node)
  464. {
  465. snode* newnode;
  466. newnode = malloc(sizeof(snode));
  467. - if (newnode == NULL) {
  468. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  469. - return;
  470. - }
  471. + if (newnode == NULL)
  472. + return 1;
  473. if (node->str)
  474. newnode->str = node->str;
  475. @@ -79,6 +77,8 @@ void slist_append(slist *l, snode *node)
  476. // make newnode current
  477. l->cur = newnode;
  478. l->cnt++;
  479. +
  480. + return 0;
  481. }
  482. void slist_clear(slist* l)
  483. --- a/src/ausearch-string.h
  484. +++ b/src/ausearch-string.h
  485. @@ -49,7 +49,7 @@ void slist_create(slist *l);
  486. static inline void slist_first(slist *l) { l->cur = l->head; }
  487. snode *slist_next(slist *l);
  488. static inline snode *slist_get_cur(slist *l) { return l->cur; }
  489. -void slist_append(slist *l, snode *node);
  490. +int slist_append(slist *l, snode *node);
  491. void slist_clear(slist* l);
  492. /* append a string if its not already on the list */
  493. --- a/tools/aulastlog/aulastlog-llist.c
  494. +++ b/tools/aulastlog/aulastlog-llist.c
  495. @@ -1,7 +1,7 @@
  496. /*
  497. * aulastlog-llist.c - Minimal linked list library
  498. -* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina.
  499. -* All Rights Reserved.
  500. +* Copyright (c) 2008 Red Hat Inc..
  501. +* All Rights Reserved.
  502. *
  503. * This software may be freely redistributed and/or modified under the
  504. * terms of the GNU General Public License as published by the Free
  505. @@ -15,7 +15,7 @@
  506. *
  507. * You should have received a copy of the GNU General Public License
  508. * along with this program; see the file COPYING. If not, write to the
  509. -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  510. +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
  511. * Boston, MA 02110-1335, USA.
  512. *
  513. * Authors:
  514. @@ -41,15 +41,13 @@ lnode *list_next(llist *l)
  515. return l->cur;
  516. }
  517. -void list_append(llist *l, lnode *node)
  518. +int list_append(llist *l, lnode *node)
  519. {
  520. lnode* newnode;
  521. newnode = malloc(sizeof(lnode));
  522. - if (newnode == NULL) {
  523. - printf("Out of memory. Check %s file, %d line", __FILE__, __LINE__);
  524. - return;
  525. - }
  526. + if (newnode == NULL)
  527. + return 1;
  528. newnode->sec = node->sec;
  529. newnode->uid = node->uid;
  530. @@ -62,7 +60,7 @@ void list_append(llist *l, lnode *node)
  531. newnode->term = strdup(node->term);
  532. else
  533. newnode->term = NULL;
  534. - newnode->item = l->cnt;
  535. + newnode->item = l->cnt;
  536. newnode->next = NULL;
  537. // if we are at top, fix this up
  538. @@ -74,6 +72,8 @@ void list_append(llist *l, lnode *node)
  539. // make newnode current
  540. l->cur = newnode;
  541. l->cnt++;
  542. +
  543. + return 0;
  544. }
  545. void list_clear(llist* l)
  546. --- a/tools/aulastlog/aulastlog-llist.h
  547. +++ b/tools/aulastlog/aulastlog-llist.h
  548. @@ -1,6 +1,6 @@
  549. /*
  550. * aulastlog-llist.h - Header file for aulastlog-llist.c
  551. -* Copyright (c) 2008 Red Hat Inc., Durham, North Carolina.
  552. +* Copyright (c) 2008 Red Hat Inc.
  553. * All Rights Reserved.
  554. *
  555. * This software may be freely redistributed and/or modified under the
  556. @@ -53,7 +53,7 @@ static inline void list_first(llist *l)
  557. lnode *list_next(llist *l);
  558. static inline lnode *list_get_cur(llist *l) { return l->cur; }
  559. static inline unsigned int list_get_cnt(llist *l) { return l->cnt; }
  560. -void list_append(llist *l, lnode *node);
  561. +int list_append(llist *l, lnode *node);
  562. void list_clear(llist* l);
  563. int list_update_login(llist* l, time_t t);
  564. int list_update_host(llist* l, const char *h);