mirror of the now-defunct rocklinux.org
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.

83 lines
2.4 KiB

  1. Our ober-guru did not wanted a new mine release - so here is
  2. my single fix.
  3. - (Slave) Rene Rebe <rene@rocklinux.org>
  4. Index: remove.c
  5. ===================================================================
  6. --- ./remove.c (revision 17)
  7. +++ ./remove.c (revision 18)
  8. @@ -70,37 +70,47 @@
  9. printf("%s: ", package);
  10. printf("removing %s\n", filename);
  11. }
  12. - else
  13. - if ( ! strncmp(filename, "var/adm/", 8) ) {
  14. - if ( mode_verbose )
  15. - printf("%s: moving %s to var/adm/backup\n",
  16. + else {
  17. + struct stat statbuf;
  18. +
  19. + snprintf(realfn1, 1024, "%s/%s", root, filename);
  20. + if ( stat(realfn1, &statbuf) )
  21. + printf("WARNING: Could not stat file %s.\n",
  22. + realfn1);
  23. +
  24. + if ( ! strncmp(filename, "var/adm/", 8) &&
  25. + ! (S_ISDIR(statbuf.st_mode)) ) {
  26. + if ( mode_verbose )
  27. + printf("%s: moving %s to var/adm/backup\n",
  28. package, filename);
  29. - snprintf(realfn1, 1024, "%s/var/adm/backup", root);
  30. - mkdir(realfn1, 0700);
  31. + snprintf(realfn1, 1024, "%s/var/adm/backup",
  32. + root);
  33. + mkdir(realfn1, 0700);
  34. - snprintf(realfn1, 1024, "%s", filename+8);
  35. - sscanf(realfn1, "%[^/]/%[^/]", buf1, buf2);
  36. + snprintf(realfn1, 1024, "%s", filename+8);
  37. + sscanf(realfn1, "%[^/]/%[^/]", buf1, buf2);
  38. - snprintf(realfn1, 1024, "%s/%s", root, filename);
  39. - snprintf(realfn2, 1024, "%s/var/adm/backup/%s_%s",
  40. - root, buf2, buf1);
  41. + snprintf(realfn1, 1024, "%s/%s", root, filename);
  42. + snprintf(realfn2, 1024, "%s/var/adm/backup/%s_%s",
  43. + root, buf2, buf1);
  44. - if ( rename(realfn1, realfn2) ) {
  45. - printf("While removing package %s: %s: %s\n",
  46. - package, realfn1, strerror(errno));
  47. - errors++;
  48. + if ( rename(realfn1, realfn2) ) {
  49. + printf("While removing package %s: %s: %s\n",
  50. + package, realfn1, strerror(errno));
  51. + errors++;
  52. + }
  53. }
  54. - }
  55. - else
  56. - {
  57. - if ( mode_verbose )
  58. - printf("%s: removing %s\n", package, filename);
  59. - snprintf(realfn1, 1024, "%s/%s", root, filename);
  60. - if ( remove(realfn1) ) {
  61. - printf("While removing package %s: %s: %s\n",
  62. - package, realfn1, strerror(errno));
  63. - errors++;
  64. + else
  65. + {
  66. + if ( mode_verbose )
  67. + printf("%s: removing %s\n",
  68. + package, filename);
  69. + if ( remove(realfn1) ) {
  70. + printf("While removing package %s: %s: %s\n",
  71. + package, realfn1, strerror(errno));
  72. + errors++;
  73. + }
  74. }
  75. }
  76. }