You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

788 lines
17 KiB

  1. --- a/lib/system.h
  2. +++ b/lib/system.h
  3. @@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t
  4. #define gettext_noop(Str) Str
  5. +#ifndef TEMP_FAILURE_RETRY
  6. +#define TEMP_FAILURE_RETRY(expression) \
  7. + (__extension__ \
  8. + ({ long int __result; \
  9. + do __result = (long int) (expression); \
  10. + while (__result == -1L && errno == EINTR); \
  11. + __result; }))
  12. +#endif
  13. +
  14. +#define error(status, errno, ...) err(status, __VA_ARGS__)
  15. static inline ssize_t __attribute__ ((unused))
  16. pwrite_retry (int fd, const void *buf, size_t len, off_t off)
  17. --- a/lib/color.c
  18. +++ b/lib/color.c
  19. @@ -32,7 +32,7 @@
  20. #endif
  21. #include <argp.h>
  22. -#include <error.h>
  23. +#include <err.h>
  24. #include <libintl.h>
  25. #include <stdlib.h>
  26. #include <string.h>
  27. --- a/lib/xmalloc.c
  28. +++ b/lib/xmalloc.c
  29. @@ -30,7 +30,7 @@
  30. # include <config.h>
  31. #endif
  32. -#include <error.h>
  33. +#include <err.h>
  34. #include <libintl.h>
  35. #include <stddef.h>
  36. #include <stdlib.h>
  37. --- a/src/addr2line.c
  38. +++ b/src/addr2line.c
  39. @@ -23,7 +23,7 @@
  40. #include <argp.h>
  41. #include <assert.h>
  42. #include <errno.h>
  43. -#include <error.h>
  44. +#include <err.h>
  45. #include <fcntl.h>
  46. #include <inttypes.h>
  47. #include <libdwfl.h>
  48. --- a/src/ar.c
  49. +++ b/src/ar.c
  50. @@ -22,7 +22,7 @@
  51. #include <argp.h>
  52. #include <assert.h>
  53. -#include <error.h>
  54. +#include <err.h>
  55. #include <fcntl.h>
  56. #include <gelf.h>
  57. #include <libintl.h>
  58. --- a/src/arlib2.c
  59. +++ b/src/arlib2.c
  60. @@ -20,7 +20,7 @@
  61. # include <config.h>
  62. #endif
  63. -#include <error.h>
  64. +#include <err.h>
  65. #include <libintl.h>
  66. #include <limits.h>
  67. #include <string.h>
  68. --- a/src/arlib.c
  69. +++ b/src/arlib.c
  70. @@ -21,7 +21,7 @@
  71. #endif
  72. #include <assert.h>
  73. -#include <error.h>
  74. +#include <err.h>
  75. #include <gelf.h>
  76. #include <libintl.h>
  77. #include <stdio.h>
  78. --- a/src/elfcmp.c
  79. +++ b/src/elfcmp.c
  80. @@ -23,7 +23,7 @@
  81. #include <argp.h>
  82. #include <assert.h>
  83. #include <errno.h>
  84. -#include <error.h>
  85. +#include <err.h>
  86. #include <fcntl.h>
  87. #include <locale.h>
  88. #include <libintl.h>
  89. --- a/src/elflint.c
  90. +++ b/src/elflint.c
  91. @@ -24,7 +24,7 @@
  92. #include <assert.h>
  93. #include <byteswap.h>
  94. #include <endian.h>
  95. -#include <error.h>
  96. +#include <err.h>
  97. #include <fcntl.h>
  98. #include <gelf.h>
  99. #include <inttypes.h>
  100. --- a/src/findtextrel.c
  101. +++ b/src/findtextrel.c
  102. @@ -23,7 +23,7 @@
  103. #include <argp.h>
  104. #include <assert.h>
  105. #include <errno.h>
  106. -#include <error.h>
  107. +#include <err.h>
  108. #include <fcntl.h>
  109. #include <gelf.h>
  110. #include <libdw.h>
  111. --- a/src/i386_ld.c
  112. +++ b/src/i386_ld.c
  113. @@ -20,7 +20,7 @@
  114. #endif
  115. #include <assert.h>
  116. -#include <error.h>
  117. +#include <err.h>
  118. #include <libintl.h>
  119. #include <stdlib.h>
  120. #include <string.h>
  121. --- a/src/ld.c
  122. +++ b/src/ld.c
  123. @@ -21,7 +21,7 @@
  124. #include <argp.h>
  125. #include <assert.h>
  126. -#include <error.h>
  127. +#include <err.h>
  128. #include <fcntl.h>
  129. #include <libelf.h>
  130. #include <libintl.h>
  131. --- a/src/ldgeneric.c
  132. +++ b/src/ldgeneric.c
  133. @@ -23,7 +23,7 @@
  134. #include <ctype.h>
  135. #include <dlfcn.h>
  136. #include <errno.h>
  137. -#include <error.h>
  138. +#include <err.h>
  139. #include <fcntl.h>
  140. #include <fnmatch.h>
  141. #include <gelf.h>
  142. --- a/src/ldlex.c
  143. +++ b/src/ldlex.c
  144. @@ -1099,7 +1099,7 @@ char *ldtext;
  145. #include <assert.h>
  146. #include <ctype.h>
  147. #include <elf.h>
  148. -#include <error.h>
  149. +#include <err.h>
  150. #include <inttypes.h>
  151. #include <libintl.h>
  152. #include <stdbool.h>
  153. --- a/src/ldscript.c
  154. +++ b/src/ldscript.c
  155. @@ -95,7 +95,7 @@
  156. #endif
  157. #include <assert.h>
  158. -#include <error.h>
  159. +#include <err.h>
  160. #include <libintl.h>
  161. #include <stdbool.h>
  162. #include <stdint.h>
  163. @@ -106,7 +106,7 @@
  164. #include <system.h>
  165. #include <ld.h>
  166. -/* The error handler. */
  167. +/* The err.handler. */
  168. static void yyerror (const char *s);
  169. /* Some helper functions we need to construct the data structures
  170. --- a/src/nm.c
  171. +++ b/src/nm.c
  172. @@ -26,7 +26,7 @@
  173. #include <ctype.h>
  174. #include <dwarf.h>
  175. #include <errno.h>
  176. -#include <error.h>
  177. +#include <err.h>
  178. #include <fcntl.h>
  179. #include <gelf.h>
  180. #include <inttypes.h>
  181. --- a/src/objdump.c
  182. +++ b/src/objdump.c
  183. @@ -21,7 +21,7 @@
  184. #endif
  185. #include <argp.h>
  186. -#include <error.h>
  187. +#include <err.h>
  188. #include <fcntl.h>
  189. #include <inttypes.h>
  190. #include <libintl.h>
  191. --- a/src/ranlib.c
  192. +++ b/src/ranlib.c
  193. @@ -24,7 +24,7 @@
  194. #include <argp.h>
  195. #include <assert.h>
  196. #include <errno.h>
  197. -#include <error.h>
  198. +#include <err.h>
  199. #include <fcntl.h>
  200. #include <gelf.h>
  201. #include <libintl.h>
  202. --- a/src/readelf.c
  203. +++ b/src/readelf.c
  204. @@ -25,7 +25,7 @@
  205. #include <ctype.h>
  206. #include <dwarf.h>
  207. #include <errno.h>
  208. -#include <error.h>
  209. +#include <err.h>
  210. #include <fcntl.h>
  211. #include <gelf.h>
  212. #include <inttypes.h>
  213. --- a/src/size.c
  214. +++ b/src/size.c
  215. @@ -21,7 +21,7 @@
  216. #endif
  217. #include <argp.h>
  218. -#include <error.h>
  219. +#include <err.h>
  220. #include <fcntl.h>
  221. #include <gelf.h>
  222. #include <inttypes.h>
  223. --- a/src/stack.c
  224. +++ b/src/stack.c
  225. @@ -18,7 +18,7 @@
  226. #include <config.h>
  227. #include <assert.h>
  228. #include <argp.h>
  229. -#include <error.h>
  230. +#include <err.h>
  231. #include <stdlib.h>
  232. #include <inttypes.h>
  233. #include <stdio.h>
  234. --- a/src/strings.c
  235. +++ b/src/strings.c
  236. @@ -25,7 +25,7 @@
  237. #include <ctype.h>
  238. #include <endian.h>
  239. #include <errno.h>
  240. -#include <error.h>
  241. +#include <err.h>
  242. #include <fcntl.h>
  243. #include <gelf.h>
  244. #include <inttypes.h>
  245. --- a/src/strip.c
  246. +++ b/src/strip.c
  247. @@ -24,7 +24,7 @@
  248. #include <assert.h>
  249. #include <byteswap.h>
  250. #include <endian.h>
  251. -#include <error.h>
  252. +#include <err.h>
  253. #include <fcntl.h>
  254. #include <gelf.h>
  255. #include <libelf.h>
  256. --- a/src/unstrip.c
  257. +++ b/src/unstrip.c
  258. @@ -31,7 +31,7 @@
  259. #include <argp.h>
  260. #include <assert.h>
  261. #include <errno.h>
  262. -#include <error.h>
  263. +#include <err.h>
  264. #include <fcntl.h>
  265. #include <fnmatch.h>
  266. #include <libintl.h>
  267. --- a/tests/addrscopes.c
  268. +++ b/tests/addrscopes.c
  269. @@ -25,7 +25,7 @@
  270. #include <stdio_ext.h>
  271. #include <locale.h>
  272. #include <stdlib.h>
  273. -#include <error.h>
  274. +#include <err.h>
  275. #include <string.h>
  276. --- a/tests/allregs.c
  277. +++ b/tests/allregs.c
  278. @@ -21,7 +21,7 @@
  279. #include <stdio.h>
  280. #include <stdlib.h>
  281. #include <string.h>
  282. -#include <error.h>
  283. +#include <err.h>
  284. #include <locale.h>
  285. #include <argp.h>
  286. #include <assert.h>
  287. --- a/tests/backtrace.c
  288. +++ b/tests/backtrace.c
  289. @@ -24,7 +24,7 @@
  290. #include <dirent.h>
  291. #include <stdlib.h>
  292. #include <errno.h>
  293. -#include <error.h>
  294. +#include <err.h>
  295. #include <unistd.h>
  296. #include <dwarf.h>
  297. #include <sys/resource.h>
  298. --- a/tests/backtrace-data.c
  299. +++ b/tests/backtrace-data.c
  300. @@ -27,7 +27,7 @@
  301. #include <dirent.h>
  302. #include <stdlib.h>
  303. #include <errno.h>
  304. -#include <error.h>
  305. +#include <err.h>
  306. #include <unistd.h>
  307. #include <dwarf.h>
  308. #include <sys/resource.h>
  309. --- a/tests/buildid.c
  310. +++ b/tests/buildid.c
  311. @@ -23,7 +23,7 @@
  312. #include ELFUTILS_HEADER(elf)
  313. #include ELFUTILS_HEADER(dwelf)
  314. #include <stdio.h>
  315. -#include <error.h>
  316. +#include <err.h>
  317. #include <string.h>
  318. #include <stdlib.h>
  319. #include <sys/types.h>
  320. --- a/tests/debugaltlink.c
  321. +++ b/tests/debugaltlink.c
  322. @@ -23,7 +23,7 @@
  323. #include ELFUTILS_HEADER(dw)
  324. #include ELFUTILS_HEADER(dwelf)
  325. #include <stdio.h>
  326. -#include <error.h>
  327. +#include <err.h>
  328. #include <string.h>
  329. #include <stdlib.h>
  330. #include <sys/types.h>
  331. --- a/tests/debuglink.c
  332. +++ b/tests/debuglink.c
  333. @@ -21,7 +21,7 @@
  334. #include <errno.h>
  335. #include ELFUTILS_HEADER(dwelf)
  336. #include <stdio.h>
  337. -#include <error.h>
  338. +#include <err.h>
  339. #include <string.h>
  340. #include <stdlib.h>
  341. #include <sys/types.h>
  342. --- a/tests/dwfl-addr-sect.c
  343. +++ b/tests/dwfl-addr-sect.c
  344. @@ -23,7 +23,7 @@
  345. #include <stdio_ext.h>
  346. #include <stdlib.h>
  347. #include <string.h>
  348. -#include <error.h>
  349. +#include <err.h>
  350. #include <locale.h>
  351. #include <argp.h>
  352. #include ELFUTILS_HEADER(dwfl)
  353. --- a/tests/dwfl-bug-addr-overflow.c
  354. +++ b/tests/dwfl-bug-addr-overflow.c
  355. @@ -20,7 +20,7 @@
  356. #include <inttypes.h>
  357. #include <stdio.h>
  358. #include <stdio_ext.h>
  359. -#include <error.h>
  360. +#include <err.h>
  361. #include <locale.h>
  362. #include ELFUTILS_HEADER(dwfl)
  363. --- a/tests/dwfl-bug-fd-leak.c
  364. +++ b/tests/dwfl-bug-fd-leak.c
  365. @@ -24,7 +24,7 @@
  366. #include <dirent.h>
  367. #include <stdlib.h>
  368. #include <errno.h>
  369. -#include <error.h>
  370. +#include <err.h>
  371. #include <unistd.h>
  372. #include <dwarf.h>
  373. #include <sys/resource.h>
  374. --- a/tests/dwfl-bug-getmodules.c
  375. +++ b/tests/dwfl-bug-getmodules.c
  376. @@ -18,7 +18,7 @@
  377. #include <config.h>
  378. #include ELFUTILS_HEADER(dwfl)
  379. -#include <error.h>
  380. +#include <err.h>
  381. static const Dwfl_Callbacks callbacks =
  382. {
  383. --- a/tests/dwfllines.c
  384. +++ b/tests/dwfllines.c
  385. @@ -27,7 +27,7 @@
  386. #include <stdio.h>
  387. #include <stdlib.h>
  388. #include <string.h>
  389. -#include <error.h>
  390. +#include <err.h>
  391. int
  392. main (int argc, char *argv[])
  393. --- a/tests/dwflmodtest.c
  394. +++ b/tests/dwflmodtest.c
  395. @@ -23,7 +23,7 @@
  396. #include <stdio_ext.h>
  397. #include <stdlib.h>
  398. #include <string.h>
  399. -#include <error.h>
  400. +#include <err.h>
  401. #include <locale.h>
  402. #include <argp.h>
  403. #include ELFUTILS_HEADER(dwfl)
  404. --- a/tests/dwfl-report-elf-align.c
  405. +++ b/tests/dwfl-report-elf-align.c
  406. @@ -20,7 +20,7 @@
  407. #include <inttypes.h>
  408. #include <stdio.h>
  409. #include <stdio_ext.h>
  410. -#include <error.h>
  411. +#include <err.h>
  412. #include <locale.h>
  413. #include <string.h>
  414. #include <stdlib.h>
  415. --- a/tests/dwflsyms.c
  416. +++ b/tests/dwflsyms.c
  417. @@ -25,7 +25,7 @@
  418. #include <stdio.h>
  419. #include <stdio_ext.h>
  420. #include <stdlib.h>
  421. -#include <error.h>
  422. +#include <err.h>
  423. #include <string.h>
  424. static const char *
  425. --- a/tests/early-offscn.c
  426. +++ b/tests/early-offscn.c
  427. @@ -19,7 +19,7 @@
  428. #endif
  429. #include <errno.h>
  430. -#include <error.h>
  431. +#include <err.h>
  432. #include <fcntl.h>
  433. #include <gelf.h>
  434. #include <stdio.h>
  435. --- a/tests/ecp.c
  436. +++ b/tests/ecp.c
  437. @@ -16,7 +16,7 @@
  438. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  439. #include <errno.h>
  440. -#include <error.h>
  441. +#include <err.h>
  442. #include <fcntl.h>
  443. #include <gelf.h>
  444. #include <stdlib.h>
  445. --- a/tests/find-prologues.c
  446. +++ b/tests/find-prologues.c
  447. @@ -25,7 +25,7 @@
  448. #include <stdio_ext.h>
  449. #include <locale.h>
  450. #include <stdlib.h>
  451. -#include <error.h>
  452. +#include <err.h>
  453. #include <string.h>
  454. #include <fnmatch.h>
  455. --- a/tests/funcretval.c
  456. +++ b/tests/funcretval.c
  457. @@ -25,7 +25,7 @@
  458. #include <stdio_ext.h>
  459. #include <locale.h>
  460. #include <stdlib.h>
  461. -#include <error.h>
  462. +#include <err.h>
  463. #include <string.h>
  464. #include <fnmatch.h>
  465. --- a/tests/funcscopes.c
  466. +++ b/tests/funcscopes.c
  467. @@ -25,7 +25,7 @@
  468. #include <stdio_ext.h>
  469. #include <locale.h>
  470. #include <stdlib.h>
  471. -#include <error.h>
  472. +#include <err.h>
  473. #include <string.h>
  474. #include <fnmatch.h>
  475. --- a/tests/line2addr.c
  476. +++ b/tests/line2addr.c
  477. @@ -26,7 +26,7 @@
  478. #include <locale.h>
  479. #include <stdlib.h>
  480. #include <string.h>
  481. -#include <error.h>
  482. +#include <err.h>
  483. static void
  484. --- a/tests/low_high_pc.c
  485. +++ b/tests/low_high_pc.c
  486. @@ -25,7 +25,7 @@
  487. #include <stdio_ext.h>
  488. #include <locale.h>
  489. #include <stdlib.h>
  490. -#include <error.h>
  491. +#include <err.h>
  492. #include <string.h>
  493. #include <fnmatch.h>
  494. --- a/tests/md5-sha1-test.c
  495. +++ b/tests/md5-sha1-test.c
  496. @@ -19,7 +19,7 @@
  497. #endif
  498. #include <string.h>
  499. -#include <error.h>
  500. +#include <err.h>
  501. #include "md5.h"
  502. #include "sha1.h"
  503. --- a/tests/rdwrmmap.c
  504. +++ b/tests/rdwrmmap.c
  505. @@ -15,7 +15,7 @@
  506. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  507. #include <errno.h>
  508. -#include <error.h>
  509. +#include <err.h>
  510. #include <stdio.h>
  511. #include <fcntl.h>
  512. #include <unistd.h>
  513. --- a/tests/saridx.c
  514. +++ b/tests/saridx.c
  515. @@ -17,7 +17,7 @@
  516. #include <config.h>
  517. -#include <error.h>
  518. +#include <err.h>
  519. #include <fcntl.h>
  520. #include <gelf.h>
  521. #include <stdio.h>
  522. --- a/tests/sectiondump.c
  523. +++ b/tests/sectiondump.c
  524. @@ -18,7 +18,7 @@
  525. #include <config.h>
  526. #include <errno.h>
  527. -#include <error.h>
  528. +#include <err.h>
  529. #include <fcntl.h>
  530. #include <gelf.h>
  531. #include <inttypes.h>
  532. --- a/tests/varlocs.c
  533. +++ b/tests/varlocs.c
  534. @@ -25,7 +25,7 @@
  535. #include <dwarf.h>
  536. #include <stdio.h>
  537. #include <stdlib.h>
  538. -#include <error.h>
  539. +#include <err.h>
  540. #include <string.h>
  541. #include <sys/types.h>
  542. #include <sys/stat.h>
  543. --- a/libelf/libelf.h
  544. +++ b/libelf/libelf.h
  545. @@ -29,6 +29,7 @@
  546. #ifndef _LIBELF_H
  547. #define _LIBELF_H 1
  548. +#include <fcntl.h>
  549. #include <sys/types.h>
  550. /* Get the ELF types. */
  551. --- a/libasm/asm_end.c
  552. +++ b/libasm/asm_end.c
  553. @@ -32,7 +32,7 @@
  554. #endif
  555. #include <assert.h>
  556. -#include <error.h>
  557. +#include <err.h>
  558. #include <libintl.h>
  559. #include <stdio.h>
  560. #include <stdlib.h>
  561. --- a/libasm/asm_newscn.c
  562. +++ b/libasm/asm_newscn.c
  563. @@ -32,7 +32,7 @@
  564. #endif
  565. #include <assert.h>
  566. -#include <error.h>
  567. +#include <err.h>
  568. #include <libintl.h>
  569. #include <stdlib.h>
  570. #include <string.h>
  571. --- a/libcpu/i386_gendis.c
  572. +++ b/libcpu/i386_gendis.c
  573. @@ -31,7 +31,7 @@
  574. # include <config.h>
  575. #endif
  576. -#include <error.h>
  577. +#include <err.h>
  578. #include <errno.h>
  579. #include <stdio.h>
  580. #include <stdlib.h>
  581. --- a/libcpu/i386_lex.c
  582. +++ b/libcpu/i386_lex.c
  583. @@ -571,7 +571,7 @@ char *i386_text;
  584. #endif
  585. #include <ctype.h>
  586. -#include <error.h>
  587. +#include <err.h>
  588. #include <libintl.h>
  589. #include <system.h>
  590. --- a/libcpu/i386_lex.l
  591. +++ b/libcpu/i386_lex.l
  592. @@ -31,7 +31,7 @@
  593. #endif
  594. #include <ctype.h>
  595. -#include <error.h>
  596. +#include <err.h>
  597. #include <libintl.h>
  598. #include <system.h>
  599. --- a/libcpu/i386_parse.c
  600. +++ b/libcpu/i386_parse.c
  601. @@ -107,7 +107,7 @@
  602. #include <assert.h>
  603. #include <ctype.h>
  604. #include <errno.h>
  605. -#include <error.h>
  606. +#include <err.h>
  607. #include <inttypes.h>
  608. #include <libintl.h>
  609. #include <math.h>
  610. --- a/libdw/libdw_alloc.c
  611. +++ b/libdw/libdw_alloc.c
  612. @@ -31,7 +31,7 @@
  613. # include <config.h>
  614. #endif
  615. -#include <error.h>
  616. +#include <err.h>
  617. #include <errno.h>
  618. #include <stdlib.h>
  619. #include <sys/param.h>
  620. @@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hid
  621. __libdw_oom (void)
  622. {
  623. while (1)
  624. - error (EXIT_FAILURE, ENOMEM, "libdw");
  625. + err (EXIT_FAILURE, "libdw: out of memory");
  626. }
  627. --- a/libebl/eblopenbackend.c
  628. +++ b/libebl/eblopenbackend.c
  629. @@ -32,7 +32,7 @@
  630. #include <assert.h>
  631. #include <dlfcn.h>
  632. -#include <error.h>
  633. +#include <err.h>
  634. #include <libelfP.h>
  635. #include <dwarf.h>
  636. #include <stdlib.h>
  637. --- a/src/ldlex.l
  638. +++ b/src/ldlex.l
  639. @@ -23,7 +23,7 @@
  640. #include <assert.h>
  641. #include <ctype.h>
  642. #include <elf.h>
  643. -#include <error.h>
  644. +#include <err.h>
  645. #include <inttypes.h>
  646. #include <libintl.h>
  647. #include <stdbool.h>
  648. --- a/libebl/eblwstrtab.c
  649. +++ b/libebl/eblwstrtab.c
  650. @@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
  651. /* Process the current node. */
  652. nodep->offset = *offsetp;
  653. - *freep = wmempcpy (*freep, nodep->string, nodep->len);
  654. + *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
  655. *offsetp += nodep->len * sizeof (wchar_t);
  656. for (subs = nodep->next; subs != NULL; subs = subs->next)
  657. --- a/libdwfl/dwfl_error.c
  658. +++ b/libdwfl/dwfl_error.c
  659. @@ -128,6 +128,7 @@ const char *
  660. dwfl_errmsg (error)
  661. int error;
  662. {
  663. + static __thread char s[64] = "";
  664. if (error == 0 || error == -1)
  665. {
  666. int last_error = global_error;
  667. @@ -142,7 +143,8 @@ dwfl_errmsg (error)
  668. switch (error &~ 0xffff)
  669. {
  670. case OTHER_ERROR (ERRNO):
  671. - return strerror_r (error & 0xffff, "bad", 0);
  672. + strerror_r (error & 0xffff, s, sizeof(s));
  673. + return s;
  674. case OTHER_ERROR (LIBELF):
  675. return elf_errmsg (error & 0xffff);
  676. case OTHER_ERROR (LIBDW):
  677. --- a/libdwfl/libdwfl.h
  678. +++ b/libdwfl/libdwfl.h
  679. @@ -31,6 +31,27 @@
  680. #include "libdw.h"
  681. #include <stdio.h>
  682. +#include <unistd.h>
  683. +#include <alloca.h>
  684. +#include <string.h>
  685. +
  686. +#ifndef TEMP_FAILURE_RETRY
  687. +#define TEMP_FAILURE_RETRY(expression) \
  688. + (__extension__ \
  689. + ({ long int __result; \
  690. + do __result = (long int) (expression); \
  691. + while (__result == -1L && errno == EINTR); \
  692. + __result; }))
  693. +#endif
  694. +
  695. +#ifndef strndupa
  696. +#define strndupa(s, n) \
  697. + (__extension__ ({const char *__in = (s); \
  698. + size_t __len = strnlen (__in, (n)) + 1; \
  699. + char *__out = (char *) alloca (__len); \
  700. + __out[__len-1] = '\0'; \
  701. + (char *) memcpy (__out, __in, __len-1);}))
  702. +#endif
  703. /* Handle for a session using the library. */
  704. typedef struct Dwfl Dwfl;
  705. --- a/libdwfl/find-debuginfo.c
  706. +++ b/libdwfl/find-debuginfo.c
  707. @@ -338,7 +338,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
  708. /* If FILE_NAME is a symlink, the debug file might be associated
  709. with the symlink target name instead. */
  710. - char *canon = canonicalize_file_name (file_name);
  711. + char *canon = realpath (file_name, NULL);
  712. if (canon != NULL && strcmp (file_name, canon))
  713. fd = find_debuginfo_in_path (mod, canon,
  714. debuglink_file, debuglink_crc,
  715. --- a/libdwfl/dwfl_build_id_find_elf.c
  716. +++ b/libdwfl/dwfl_build_id_find_elf.c
  717. @@ -80,7 +80,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
  718. {
  719. if (*file_name != NULL)
  720. free (*file_name);
  721. - *file_name = canonicalize_file_name (name);
  722. + *file_name = realpath (name, NULL);
  723. if (*file_name == NULL)
  724. {
  725. *file_name = name;
  726. --- a/libelf/elf_getarsym.c
  727. +++ b/libelf/elf_getarsym.c
  728. @@ -284,7 +284,7 @@ elf_getarsym (elf, ptr)
  729. arsym[cnt].as_off = file_data->u32[cnt];
  730. arsym[cnt].as_hash = _dl_elf_hash (str_data);
  731. - str_data = rawmemchr (str_data, '\0') + 1;
  732. + str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
  733. }
  734. /* At the end a special entry. */