Fix: Initialize fd field of struct lttng_ust_elf to -1 at allocation
[lttng-ust.git] / liblttng-ust / lttng-ust-elf.c
CommitLineData
8e2aed3f
AB
1/*
2 * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
aaf93c60 19#define _GNU_SOURCE
3fbec7dc 20#define _LGPL_SOURCE
8e2aed3f
AB
21#include <helper.h>
22#include <string.h>
23#include <lttng/align.h>
24#include <lttng/ust-elf.h>
405be658
MD
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <fcntl.h>
28#include <unistd.h>
97c7c238 29#include <stdbool.h>
ba8dcc8c 30#include <ust-fd.h>
405be658
MD
31#include "lttng-tracer-core.h"
32
33#define BUF_LEN 4096
8e2aed3f 34
2df586a6
PP
35#ifndef NT_GNU_BUILD_ID
36# define NT_GNU_BUILD_ID 3
37#endif
38
8e2aed3f
AB
39/*
40 * Retrieve the nth (where n is the `index` argument) phdr (program
41 * header) from the given elf instance.
42 *
43 * A pointer to the phdr is returned on success, NULL on failure.
44 */
45static
46struct lttng_ust_elf_phdr *lttng_ust_elf_get_phdr(struct lttng_ust_elf *elf,
47 uint16_t index)
48{
49 struct lttng_ust_elf_phdr *phdr = NULL;
f5a6717a 50 off_t offset;
8e2aed3f
AB
51
52 if (!elf) {
53 goto error;
54 }
55
56 if (index >= elf->ehdr->e_phnum) {
57 goto error;
58 }
59
60 phdr = zmalloc(sizeof(struct lttng_ust_elf_phdr));
61 if (!phdr) {
62 goto error;
63 }
64
f5a6717a
MD
65 offset = (off_t) elf->ehdr->e_phoff
66 + (off_t) index * elf->ehdr->e_phentsize;
405be658 67 if (lseek(elf->fd, offset, SEEK_SET) < 0) {
8e2aed3f
AB
68 goto error;
69 }
70
71 if (is_elf_32_bit(elf)) {
72 Elf32_Phdr elf_phdr;
73
405be658
MD
74 if (lttng_ust_read(elf->fd, &elf_phdr, sizeof(elf_phdr))
75 < sizeof(elf_phdr)) {
8e2aed3f
AB
76 goto error;
77 }
78 if (!is_elf_native_endian(elf)) {
79 bswap_phdr(elf_phdr);
80 }
81 copy_phdr(elf_phdr, *phdr);
82 } else {
83 Elf64_Phdr elf_phdr;
84
405be658
MD
85 if (lttng_ust_read(elf->fd, &elf_phdr, sizeof(elf_phdr))
86 < sizeof(elf_phdr)) {
8e2aed3f
AB
87 goto error;
88 }
89 if (!is_elf_native_endian(elf)) {
90 bswap_phdr(elf_phdr);
91 }
92 copy_phdr(elf_phdr, *phdr);
93 }
94
95 return phdr;
96
97error:
98 free(phdr);
99 return NULL;
100}
101
102/*
103 * Retrieve the nth (where n is the `index` argument) shdr (section
104 * header) from the given elf instance.
105 *
106 * A pointer to the shdr is returned on success, NULL on failure.
107 */
108static
109struct lttng_ust_elf_shdr *lttng_ust_elf_get_shdr(struct lttng_ust_elf *elf,
110 uint16_t index)
111{
112 struct lttng_ust_elf_shdr *shdr = NULL;
4c5dac0d 113 off_t offset;
8e2aed3f
AB
114
115 if (!elf) {
116 goto error;
117 }
118
119 if (index >= elf->ehdr->e_shnum) {
120 goto error;
121 }
122
123 shdr = zmalloc(sizeof(struct lttng_ust_elf_shdr));
124 if (!shdr) {
125 goto error;
126 }
127
4c5dac0d 128 offset = (off_t) elf->ehdr->e_shoff
5a26ac54 129 + (off_t) index * elf->ehdr->e_shentsize;
405be658 130 if (lseek(elf->fd, offset, SEEK_SET) < 0) {
8e2aed3f
AB
131 goto error;
132 }
133
134 if (is_elf_32_bit(elf)) {
135 Elf32_Shdr elf_shdr;
136
405be658
MD
137 if (lttng_ust_read(elf->fd, &elf_shdr, sizeof(elf_shdr))
138 < sizeof(elf_shdr)) {
8e2aed3f
AB
139 goto error;
140 }
141 if (!is_elf_native_endian(elf)) {
142 bswap_shdr(elf_shdr);
143 }
144 copy_shdr(elf_shdr, *shdr);
145 } else {
146 Elf64_Shdr elf_shdr;
147
405be658
MD
148 if (lttng_ust_read(elf->fd, &elf_shdr, sizeof(elf_shdr))
149 < sizeof(elf_shdr)) {
8e2aed3f
AB
150 goto error;
151 }
152 if (!is_elf_native_endian(elf)) {
153 bswap_shdr(elf_shdr);
154 }
155 copy_shdr(elf_shdr, *shdr);
156 }
157
158 return shdr;
159
160error:
161 free(shdr);
162 return NULL;
163}
164
165/*
166 * Lookup a section's name from a given offset (usually from an shdr's
167 * sh_name value) in bytes relative to the beginning of the section
168 * names string table.
169 *
170 * If no name is found, NULL is returned.
171 */
172static
f5a6717a 173char *lttng_ust_elf_get_section_name(struct lttng_ust_elf *elf, off_t offset)
8e2aed3f
AB
174{
175 char *name = NULL;
405be658 176 size_t len = 0, to_read; /* len does not include \0 */
8e2aed3f
AB
177
178 if (!elf) {
179 goto error;
180 }
181
182 if (offset >= elf->section_names_size) {
183 goto error;
184 }
185
405be658 186 if (lseek(elf->fd, elf->section_names_offset + offset, SEEK_SET) < 0) {
8e2aed3f
AB
187 goto error;
188 }
405be658
MD
189
190 to_read = elf->section_names_size - offset;
191
192 /* Find first \0 after or at current location, remember len. */
193 for (;;) {
194 char buf[BUF_LEN];
195 ssize_t read_len;
196 size_t i;
197
198 if (!to_read) {
8e2aed3f 199 goto error;
8e2aed3f 200 }
405be658
MD
201 read_len = lttng_ust_read(elf->fd, buf,
202 min_t(size_t, BUF_LEN, to_read));
203 if (read_len <= 0) {
204 goto error;
205 }
206 for (i = 0; i < read_len; i++) {
207 if (buf[i] == '\0') {
208 len += i;
209 goto end;
210 }
211 }
212 len += read_len;
213 to_read -= read_len;
8e2aed3f 214 }
8e2aed3f 215end:
405be658 216 name = zmalloc(sizeof(char) * (len + 1)); /* + 1 for \0 */
8e2aed3f
AB
217 if (!name) {
218 goto error;
219 }
405be658
MD
220 if (lseek(elf->fd, elf->section_names_offset + offset,
221 SEEK_SET) < 0) {
8e2aed3f
AB
222 goto error;
223 }
405be658 224 if (lttng_ust_read(elf->fd, name, len + 1) < len + 1) {
8e2aed3f
AB
225 goto error;
226 }
227
228 return name;
229
230error:
231 free(name);
232 return NULL;
233}
234
235/*
236 * Create an instance of lttng_ust_elf for the ELF file located at
237 * `path`.
238 *
239 * Return a pointer to the instance on success, NULL on failure.
240 */
241struct lttng_ust_elf *lttng_ust_elf_create(const char *path)
242{
243 uint8_t e_ident[EI_NIDENT];
244 struct lttng_ust_elf_shdr *section_names_shdr;
405be658 245 struct lttng_ust_elf *elf = NULL;
f5c453e9 246 int ret, fd;
8e2aed3f
AB
247
248 elf = zmalloc(sizeof(struct lttng_ust_elf));
249 if (!elf) {
250 goto error;
251 }
252
1ac2e79c
JR
253 /* Initialize fd field to -1. 0 is a valid fd number */
254 elf->fd = -1;
ba8dcc8c 255
8e2aed3f
AB
256 elf->path = strdup(path);
257 if (!elf->path) {
258 goto error;
259 }
260
ba8dcc8c 261 lttng_ust_lock_fd_tracker();
f5c453e9
JR
262 fd = open(elf->path, O_RDONLY | O_CLOEXEC);
263 if (fd < 0) {
ba8dcc8c 264 lttng_ust_unlock_fd_tracker();
8e2aed3f
AB
265 goto error;
266 }
f5c453e9
JR
267
268 ret = lttng_ust_add_fd_to_tracker(fd);
269 if (ret < 0) {
270 ret = close(fd);
271 if (ret) {
272 PERROR("close on elf->fd");
273 }
274 ret = -1;
275 lttng_ust_unlock_fd_tracker();
276 goto error;
277 }
278 elf->fd = ret;
ba8dcc8c 279 lttng_ust_unlock_fd_tracker();
8e2aed3f 280
405be658 281 if (lttng_ust_read(elf->fd, e_ident, EI_NIDENT) < EI_NIDENT) {
8e2aed3f
AB
282 goto error;
283 }
284 elf->bitness = e_ident[EI_CLASS];
285 elf->endianness = e_ident[EI_DATA];
405be658
MD
286
287 if (lseek(elf->fd, 0, SEEK_SET) < 0) {
288 goto error;
289 }
8e2aed3f
AB
290
291 elf->ehdr = zmalloc(sizeof(struct lttng_ust_elf_ehdr));
292 if (!elf->ehdr) {
293 goto error;
294 }
295
296 if (is_elf_32_bit(elf)) {
297 Elf32_Ehdr elf_ehdr;
298
405be658
MD
299 if (lttng_ust_read(elf->fd, &elf_ehdr, sizeof(elf_ehdr))
300 < sizeof(elf_ehdr)) {
8e2aed3f
AB
301 goto error;
302 }
303 if (!is_elf_native_endian(elf)) {
304 bswap_ehdr(elf_ehdr);
305 }
306 copy_ehdr(elf_ehdr, *(elf->ehdr));
307 } else {
308 Elf64_Ehdr elf_ehdr;
309
405be658
MD
310 if (lttng_ust_read(elf->fd, &elf_ehdr, sizeof(elf_ehdr))
311 < sizeof(elf_ehdr)) {
8e2aed3f
AB
312 goto error;
313 }
314 if (!is_elf_native_endian(elf)) {
315 bswap_ehdr(elf_ehdr);
316 }
317 copy_ehdr(elf_ehdr, *(elf->ehdr));
318 }
319
320 section_names_shdr = lttng_ust_elf_get_shdr(elf, elf->ehdr->e_shstrndx);
321 if (!section_names_shdr) {
322 goto error;
323 }
324
325 elf->section_names_offset = section_names_shdr->sh_offset;
326 elf->section_names_size = section_names_shdr->sh_size;
327
328 free(section_names_shdr);
8e2aed3f
AB
329 return elf;
330
331error:
ba8dcc8c 332 lttng_ust_elf_destroy(elf);
8e2aed3f
AB
333 return NULL;
334}
335
f5eb039d
AB
336/*
337 * Test whether the ELF file is position independent code (PIC)
338 */
339uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf)
340{
341 /*
342 * PIC has and e_type value of ET_DYN, see ELF specification
343 * version 1.1 p. 1-3.
344 */
345 return elf->ehdr->e_type == ET_DYN;
346}
347
8e2aed3f
AB
348/*
349 * Destroy the given lttng_ust_elf instance.
350 */
351void lttng_ust_elf_destroy(struct lttng_ust_elf *elf)
352{
ba8dcc8c
JR
353 int ret;
354
8e2aed3f
AB
355 if (!elf) {
356 return;
357 }
358
ba8dcc8c
JR
359 if (elf->fd >= 0) {
360 lttng_ust_lock_fd_tracker();
361 ret = close(elf->fd);
362 if (!ret) {
363 lttng_ust_delete_fd_from_tracker(elf->fd);
364 } else {
365 PERROR("close");
366 abort();
367 }
368 lttng_ust_unlock_fd_tracker();
405be658 369 }
ba8dcc8c
JR
370
371 free(elf->ehdr);
8e2aed3f
AB
372 free(elf->path);
373 free(elf);
374}
375
376/*
377 * Compute the total in-memory size of the ELF file, in bytes.
378 *
379 * Returns 0 if successful, -1 if not. On success, the memory size is
380 * returned through the out parameter `memsz`.
381 */
382int lttng_ust_elf_get_memsz(struct lttng_ust_elf *elf, uint64_t *memsz)
383{
384 uint16_t i;
e1f0c569 385 uint64_t low_addr = UINT64_MAX, high_addr = 0;
8e2aed3f
AB
386
387 if (!elf || !memsz) {
388 goto error;
389 }
390
391 for (i = 0; i < elf->ehdr->e_phnum; ++i) {
392 struct lttng_ust_elf_phdr *phdr;
8e2aed3f
AB
393
394 phdr = lttng_ust_elf_get_phdr(elf, i);
395 if (!phdr) {
396 goto error;
397 }
398
399 /*
400 * Only PT_LOAD segments contribute to memsz. Skip
401 * other segments.
402 */
403 if (phdr->p_type != PT_LOAD) {
404 goto next_loop;
405 }
406
8886accb
MD
407 low_addr = min_t(uint64_t, low_addr, phdr->p_vaddr);
408 high_addr = max_t(uint64_t, high_addr,
409 phdr->p_vaddr + phdr->p_memsz);
8e2aed3f
AB
410 next_loop:
411 free(phdr);
412 }
413
e1f0c569
AB
414 if (high_addr < low_addr) {
415 /* No PT_LOAD segments or corrupted data. */
416 goto error;
417 }
418
419 *memsz = high_addr - low_addr;
8e2aed3f
AB
420 return 0;
421error:
422 return -1;
423}
424
425/*
426 * Internal method used to try and get the build_id from a PT_NOTE
427 * segment ranging from `offset` to `segment_end`.
428 *
429 * If the function returns successfully, the out parameter `found`
430 * indicates whether the build id information was present in the
431 * segment or not. If `found` is not 0, the out parameters `build_id`
432 * and `length` will both have been set with the retrieved
433 * information.
434 *
435 * Returns 0 on success, -1 if an error occurred.
436 */
437static
438int lttng_ust_elf_get_build_id_from_segment(
439 struct lttng_ust_elf *elf, uint8_t **build_id, size_t *length,
82ee1ee4 440 off_t offset, off_t segment_end)
8e2aed3f 441{
814d07b1
MD
442 uint8_t *_build_id = NULL; /* Silence old gcc warning. */
443 size_t _length = 0; /* Silence old gcc warning. */
8e2aed3f
AB
444
445 while (offset < segment_end) {
446 struct lttng_ust_elf_nhdr nhdr;
405be658 447 size_t read_len;
8e2aed3f
AB
448
449 /* Align start of note entry */
450 offset += offset_align(offset, ELF_NOTE_ENTRY_ALIGN);
451 if (offset >= segment_end) {
452 break;
453 }
454 /*
455 * We seek manually because if the note isn't the
456 * build id the data following the header will not
457 * have been read.
458 */
405be658 459 if (lseek(elf->fd, offset, SEEK_SET) < 0) {
8e2aed3f
AB
460 goto error;
461 }
405be658
MD
462 if (lttng_ust_read(elf->fd, &nhdr, sizeof(nhdr))
463 < sizeof(nhdr)) {
8e2aed3f
AB
464 goto error;
465 }
466
467 if (!is_elf_native_endian(elf)) {
468 nhdr.n_namesz = bswap_32(nhdr.n_namesz);
469 nhdr.n_descsz = bswap_32(nhdr.n_descsz);
470 nhdr.n_type = bswap_32(nhdr.n_type);
471 }
472
473 offset += sizeof(nhdr) + nhdr.n_namesz;
474 /* Align start of desc entry */
475 offset += offset_align(offset, ELF_NOTE_DESC_ALIGN);
476
477 if (nhdr.n_type != NT_GNU_BUILD_ID) {
478 /*
479 * Ignore non build id notes but still
480 * increase the offset.
481 */
482 offset += nhdr.n_descsz;
483 continue;
484 }
485
486 _length = nhdr.n_descsz;
487 _build_id = zmalloc(sizeof(uint8_t) * _length);
5ada26b4 488 if (!_build_id) {
8e2aed3f
AB
489 goto error;
490 }
491
405be658 492 if (lseek(elf->fd, offset, SEEK_SET) < 0) {
8e2aed3f
AB
493 goto error;
494 }
405be658
MD
495 read_len = sizeof(*_build_id) * _length;
496 if (lttng_ust_read(elf->fd, _build_id, read_len) < read_len) {
8e2aed3f
AB
497 goto error;
498 }
499
8e2aed3f
AB
500 break;
501 }
502
82ee1ee4 503 if (_build_id) {
8e2aed3f
AB
504 *build_id = _build_id;
505 *length = _length;
506 }
507
8e2aed3f
AB
508 return 0;
509error:
83215d66 510 free(_build_id);
8e2aed3f
AB
511 return -1;
512}
513
514/*
515 * Retrieve a build ID (an array of bytes) from the corresponding
516 * section in the ELF file. The length of the build ID can be either
517 * 16 or 20 bytes depending on the method used to generate it, hence
518 * the length out parameter.
519 *
520 * If the function returns successfully, the out parameter `found`
521 * indicates whether the build id information was present in the ELF
522 * file or not. If `found` is not 0, the out parameters `build_id` and
523 * `length` will both have been set with the retrieved information.
524 *
525 * Returns 0 on success, -1 if an error occurred.
526 */
527int lttng_ust_elf_get_build_id(struct lttng_ust_elf *elf, uint8_t **build_id,
528 size_t *length, int *found)
529{
530 uint16_t i;
8c83dbda
MD
531 uint8_t *_build_id = NULL; /* Silence old gcc warning. */
532 size_t _length = 0; /* Silence old gcc warning. */
8e2aed3f
AB
533
534 if (!elf || !build_id || !length || !found) {
535 goto error;
536 }
537
538 for (i = 0; i < elf->ehdr->e_phnum; ++i) {
f5a6717a 539 off_t offset, segment_end;
8e2aed3f 540 struct lttng_ust_elf_phdr *phdr;
5b3bbf98 541 int ret = 0;
8e2aed3f
AB
542
543 phdr = lttng_ust_elf_get_phdr(elf, i);
544 if (!phdr) {
545 goto error;
546 }
547
548 /* Build ID will be contained in a PT_NOTE segment. */
549 if (phdr->p_type != PT_NOTE) {
550 goto next_loop;
551 }
552
553 offset = phdr->p_offset;
554 segment_end = offset + phdr->p_filesz;
555 ret = lttng_ust_elf_get_build_id_from_segment(
82ee1ee4 556 elf, &_build_id, &_length, offset, segment_end);
8e2aed3f
AB
557 next_loop:
558 free(phdr);
559 if (ret) {
560 goto error;
561 }
82ee1ee4 562 if (_build_id) {
8e2aed3f
AB
563 break;
564 }
565 }
566
82ee1ee4 567 if (_build_id) {
8e2aed3f
AB
568 *build_id = _build_id;
569 *length = _length;
82ee1ee4
AB
570 *found = 1;
571 } else {
572 *found = 0;
8e2aed3f
AB
573 }
574
8e2aed3f
AB
575 return 0;
576error:
99b7132d 577 free(_build_id);
8e2aed3f
AB
578 return -1;
579}
580
581/*
582 * Try to retrieve filename and CRC from given ELF section `shdr`.
583 *
584 * If the function returns successfully, the out parameter `found`
585 * indicates whether the debug link information was present in the ELF
586 * section or not. If `found` is not 0, the out parameters `filename` and
587 * `crc` will both have been set with the retrieved information.
588 *
589 * Returns 0 on success, -1 if an error occurred.
590 */
8e2aed3f
AB
591int lttng_ust_elf_get_debug_link_from_section(struct lttng_ust_elf *elf,
592 char **filename, uint32_t *crc,
8e2aed3f
AB
593 struct lttng_ust_elf_shdr *shdr)
594{
8c83dbda 595 char *_filename = NULL; /* Silence old gcc warning. */
405be658 596 size_t filename_len;
8e2aed3f 597 char *section_name = NULL;
8c83dbda 598 uint32_t _crc = 0; /* Silence old gcc warning. */
8e2aed3f 599
82ee1ee4 600 if (!elf || !filename || !crc || !shdr) {
8e2aed3f
AB
601 goto error;
602 }
603
604 /*
605 * The .gnu_debuglink section is of type SHT_PROGBITS,
606 * skip the other sections.
607 */
608 if (shdr->sh_type != SHT_PROGBITS) {
609 goto end;
610 }
611
612 section_name = lttng_ust_elf_get_section_name(elf,
613 shdr->sh_name);
614 if (!section_name) {
615 goto end;
616 }
617 if (strcmp(section_name, ".gnu_debuglink")) {
618 goto end;
619 }
620
621 /*
622 * The length of the filename is the sh_size excluding the CRC
623 * which comes after it in the section.
624 */
625 _filename = zmalloc(sizeof(char) * (shdr->sh_size - ELF_CRC_SIZE));
626 if (!_filename) {
627 goto error;
628 }
405be658 629 if (lseek(elf->fd, shdr->sh_offset, SEEK_SET) < 0) {
8e2aed3f
AB
630 goto error;
631 }
405be658
MD
632 filename_len = sizeof(*_filename) * (shdr->sh_size - ELF_CRC_SIZE);
633 if (lttng_ust_read(elf->fd, _filename, filename_len) < filename_len) {
8e2aed3f
AB
634 goto error;
635 }
405be658 636 if (lttng_ust_read(elf->fd, &_crc, sizeof(_crc)) < sizeof(_crc)) {
8e2aed3f
AB
637 goto error;
638 }
639 if (!is_elf_native_endian(elf)) {
640 _crc = bswap_32(_crc);
641 }
642
8e2aed3f
AB
643end:
644 free(section_name);
82ee1ee4 645 if (_filename) {
8e2aed3f
AB
646 *filename = _filename;
647 *crc = _crc;
648 }
8e2aed3f
AB
649
650 return 0;
651
652error:
83215d66
MD
653 free(_filename);
654 free(section_name);
8e2aed3f
AB
655 return -1;
656}
657
658/*
659 * Retrieve filename and CRC from ELF's .gnu_debuglink section, if any.
660 *
661 * If the function returns successfully, the out parameter `found`
662 * indicates whether the debug link information was present in the ELF
663 * file or not. If `found` is not 0, the out parameters `filename` and
664 * `crc` will both have been set with the retrieved information.
665 *
666 * Returns 0 on success, -1 if an error occurred.
667 */
668int lttng_ust_elf_get_debug_link(struct lttng_ust_elf *elf, char **filename,
669 uint32_t *crc, int *found)
670{
671 int ret;
672 uint16_t i;
8c83dbda
MD
673 char *_filename = NULL; /* Silence old gcc warning. */
674 uint32_t _crc = 0; /* Silence old gcc warning. */
8e2aed3f
AB
675
676 if (!elf || !filename || !crc || !found) {
677 goto error;
678 }
679
680 for (i = 0; i < elf->ehdr->e_shnum; ++i) {
681 struct lttng_ust_elf_shdr *shdr = NULL;
682
683 shdr = lttng_ust_elf_get_shdr(elf, i);
684 if (!shdr) {
685 goto error;
686 }
687
688 ret = lttng_ust_elf_get_debug_link_from_section(
82ee1ee4 689 elf, &_filename, &_crc, shdr);
8e2aed3f
AB
690 free(shdr);
691
692 if (ret) {
693 goto error;
694 }
82ee1ee4 695 if (_filename) {
8e2aed3f
AB
696 break;
697 }
698 }
699
82ee1ee4 700 if (_filename) {
8e2aed3f
AB
701 *filename = _filename;
702 *crc = _crc;
82ee1ee4
AB
703 *found = 1;
704 } else {
705 *found = 0;
8e2aed3f
AB
706 }
707
8e2aed3f 708 return 0;
82ee1ee4 709
8e2aed3f 710error:
99b7132d 711 free(_filename);
8e2aed3f
AB
712 return -1;
713}
This page took 0.054774 seconds and 4 git commands to generate.