0001-fix-var-declare-in-label-error.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From b960c0b43a080287a7c13533eeb2d9f288db1414 Mon Sep 17 00:00:00 2001
  2. From: Florian Festi <ffesti@redhat.com>
  3. Date: Thu, 16 Mar 2023 19:05:04 +0100
  4. Subject: [PATCH] Fix compiler error on clang
  5. Turns out variable declarations are not allowed after a label, even in
  6. C99. And while some compilers don't seem to care others do.
  7. Moving the declaration of mayopen to the start of the function to avoid
  8. this problem.
  9. Resolves: #2435
  10. Upstream: b960c0b43a080287a7c13533eeb2d9f288db1414
  11. Signed-off-by: James Knight <james.d.knight@live.com>
  12. ---
  13. lib/fsm.c | 3 ++-
  14. 1 file changed, 2 insertions(+), 1 deletion(-)
  15. diff --git a/lib/fsm.c b/lib/fsm.c
  16. index 5671ac642d..183293edb0 100644
  17. --- a/lib/fsm.c
  18. +++ b/lib/fsm.c
  19. @@ -879,6 +879,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
  20. int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0;
  21. int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0;
  22. int firstlinkfile = -1;
  23. + int mayopen = 0;
  24. char *tid = NULL;
  25. struct filedata_s *fdata = xcalloc(fc, sizeof(*fdata));
  26. struct filedata_s *firstlink = NULL;
  27. @@ -1016,7 +1017,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
  28. setmeta:
  29. /* Special files require path-based ops */
  30. - int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
  31. + mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
  32. if (!rc && fd == -1 && mayopen) {
  33. int flags = O_RDONLY;
  34. /* Only follow safe symlinks, and never on temporary files */