logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

stat_override.c (831B)


  1. /*
  2. * SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
  3. * SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0-or-later
  6. */
  7. #include <sys/stat.h>
  8. #include <linux/syscall.h>
  9. #include <linux/x86/syscall.h>
  10. int _lstat(const char *path, struct stat *buf) {
  11. int rc = lstat(path, buf);
  12. if (rc == 0) {
  13. buf->st_atime = 0;
  14. buf->st_mtime = 0;
  15. }
  16. return rc;
  17. }
  18. /* stat is deliberately hacked to be lstat.
  19. In src/system.h tar already defines lstat to be stat
  20. since S_ISLNK is not defined in mes C library
  21. Hence, we can't use something like #define lstat(a,b) _lstat(a,b)
  22. to have separate stat and lstat functions.
  23. Thus here we break tar with --dereference option but we don't use
  24. this option in live-bootstrap.
  25. */
  26. #define stat(a,b) _lstat(a,b)