diff options
author | Reiner Herrmann <reiner@reiner-h.de> | 2019-07-11 21:39:55 +0200 |
---|---|---|
committer | Reiner Herrmann <reiner@reiner-h.de> | 2019-07-11 21:39:57 +0200 |
commit | 6a0d5aaaa236d05f789620d42232d87c33f15713 (patch) | |
tree | d42f259aa8bab8cedaf57c99c7c9aa326ea22947 /src/libtrace | |
parent | fix minor issues from lgtm.com (diff) | |
download | firejail-6a0d5aaaa236d05f789620d42232d87c33f15713.tar.gz firejail-6a0d5aaaa236d05f789620d42232d87c33f15713.tar.zst firejail-6a0d5aaaa236d05f789620d42232d87c33f15713.zip |
rename some variables so they don't shadow others with same name
via lgtm.com
Diffstat (limited to 'src/libtrace')
-rw-r--r-- | src/libtrace/libtrace.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index 1cab1ed3c..60fdb5470 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c | |||
@@ -402,50 +402,50 @@ int rmdir(const char *pathname) { | |||
402 | } | 402 | } |
403 | 403 | ||
404 | // stat | 404 | // stat |
405 | typedef int (*orig_stat_t)(const char *pathname, struct stat *buf); | 405 | typedef int (*orig_stat_t)(const char *pathname, struct stat *statbuf); |
406 | static orig_stat_t orig_stat = NULL; | 406 | static orig_stat_t orig_stat = NULL; |
407 | int stat(const char *pathname, struct stat *buf) { | 407 | int stat(const char *pathname, struct stat *statbuf) { |
408 | if (!orig_stat) | 408 | if (!orig_stat) |
409 | orig_stat = (orig_stat_t)dlsym(RTLD_NEXT, "stat"); | 409 | orig_stat = (orig_stat_t)dlsym(RTLD_NEXT, "stat"); |
410 | 410 | ||
411 | int rv = orig_stat(pathname, buf); | 411 | int rv = orig_stat(pathname, statbuf); |
412 | fprintf(ftty, "%u:%s:stat %s:%d\n", mypid, myname, pathname, rv); | 412 | fprintf(ftty, "%u:%s:stat %s:%d\n", mypid, myname, pathname, rv); |
413 | return rv; | 413 | return rv; |
414 | } | 414 | } |
415 | 415 | ||
416 | #ifdef __GLIBC__ | 416 | #ifdef __GLIBC__ |
417 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf); | 417 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf); |
418 | static orig_stat64_t orig_stat64 = NULL; | 418 | static orig_stat64_t orig_stat64 = NULL; |
419 | int stat64(const char *pathname, struct stat64 *buf) { | 419 | int stat64(const char *pathname, struct stat64 *statbuf) { |
420 | if (!orig_stat64) | 420 | if (!orig_stat64) |
421 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); | 421 | orig_stat64 = (orig_stat64_t)dlsym(RTLD_NEXT, "stat64"); |
422 | 422 | ||
423 | int rv = orig_stat64(pathname, buf); | 423 | int rv = orig_stat64(pathname, statbuf); |
424 | fprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); | 424 | fprintf(ftty, "%u:%s:stat64 %s:%d\n", mypid, myname, pathname, rv); |
425 | return rv; | 425 | return rv; |
426 | } | 426 | } |
427 | #endif /* __GLIBC__ */ | 427 | #endif /* __GLIBC__ */ |
428 | 428 | ||
429 | // lstat | 429 | // lstat |
430 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *buf); | 430 | typedef int (*orig_lstat_t)(const char *pathname, struct stat *statbuf); |
431 | static orig_lstat_t orig_lstat = NULL; | 431 | static orig_lstat_t orig_lstat = NULL; |
432 | int lstat(const char *pathname, struct stat *buf) { | 432 | int lstat(const char *pathname, struct stat *statbuf) { |
433 | if (!orig_lstat) | 433 | if (!orig_lstat) |
434 | orig_lstat = (orig_lstat_t)dlsym(RTLD_NEXT, "lstat"); | 434 | orig_lstat = (orig_lstat_t)dlsym(RTLD_NEXT, "lstat"); |
435 | 435 | ||
436 | int rv = orig_lstat(pathname, buf); | 436 | int rv = orig_lstat(pathname, statbuf); |
437 | fprintf(ftty, "%u:%s:lstat %s:%d\n", mypid, myname, pathname, rv); | 437 | fprintf(ftty, "%u:%s:lstat %s:%d\n", mypid, myname, pathname, rv); |
438 | return rv; | 438 | return rv; |
439 | } | 439 | } |
440 | 440 | ||
441 | #ifdef __GLIBC__ | 441 | #ifdef __GLIBC__ |
442 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *buf); | 442 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf); |
443 | static orig_lstat64_t orig_lstat64 = NULL; | 443 | static orig_lstat64_t orig_lstat64 = NULL; |
444 | int lstat64(const char *pathname, struct stat64 *buf) { | 444 | int lstat64(const char *pathname, struct stat64 *statbuf) { |
445 | if (!orig_lstat64) | 445 | if (!orig_lstat64) |
446 | orig_lstat64 = (orig_lstat64_t)dlsym(RTLD_NEXT, "lstat64"); | 446 | orig_lstat64 = (orig_lstat64_t)dlsym(RTLD_NEXT, "lstat64"); |
447 | 447 | ||
448 | int rv = orig_lstat64(pathname, buf); | 448 | int rv = orig_lstat64(pathname, statbuf); |
449 | fprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); | 449 | fprintf(ftty, "%u:%s:lstat64 %s:%d\n", mypid, myname, pathname, rv); |
450 | return rv; | 450 | return rv; |
451 | } | 451 | } |
@@ -492,13 +492,13 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { | |||
492 | // socket | 492 | // socket |
493 | typedef int (*orig_socket_t)(int domain, int type, int protocol); | 493 | typedef int (*orig_socket_t)(int domain, int type, int protocol); |
494 | static orig_socket_t orig_socket = NULL; | 494 | static orig_socket_t orig_socket = NULL; |
495 | static char buf[1024]; | 495 | static char socketbuf[1024]; |
496 | int socket(int domain, int type, int protocol) { | 496 | int socket(int domain, int type, int protocol) { |
497 | if (!orig_socket) | 497 | if (!orig_socket) |
498 | orig_socket = (orig_socket_t)dlsym(RTLD_NEXT, "socket"); | 498 | orig_socket = (orig_socket_t)dlsym(RTLD_NEXT, "socket"); |
499 | 499 | ||
500 | int rv = orig_socket(domain, type, protocol); | 500 | int rv = orig_socket(domain, type, protocol); |
501 | char *ptr = buf; | 501 | char *ptr = socketbuf; |
502 | ptr += sprintf(ptr, "%u:%s:socket ", mypid, myname); | 502 | ptr += sprintf(ptr, "%u:%s:socket ", mypid, myname); |
503 | char *str = translate(socket_domain, domain); | 503 | char *str = translate(socket_domain, domain); |
504 | if (str == NULL) | 504 | if (str == NULL) |
@@ -529,7 +529,7 @@ int socket(int domain, int type, int protocol) { | |||
529 | sprintf(ptr, "%s", str); | 529 | sprintf(ptr, "%s", str); |
530 | } | 530 | } |
531 | 531 | ||
532 | fprintf(ftty, "%s:%d\n", buf, rv); | 532 | fprintf(ftty, "%s:%d\n", socketbuf, rv); |
533 | return rv; | 533 | return rv; |
534 | } | 534 | } |
535 | 535 | ||