patch-bzip2_c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. $OpenBSD: patch-bzip2_c,v 1.6 2015/10/15 20:14:36 sthen Exp $
  2. --- bzip2.c.orig Sat Sep 11 00:04:53 2010
  3. +++ bzip2.c Thu Oct 15 01:55:25 2015
  4. @@ -1257,6 +1257,17 @@ void compress ( Char *name )
  5. setExit(1);
  6. return;
  7. };
  8. + if (numFileNames == 1) { /* stdout, and only one input file */
  9. + if (pledge("stdio", NULL) == -1) {
  10. + fprintf ( stderr, "%s: pledge\n", progName );
  11. + exit ( 1 );
  12. + }
  13. + } else {
  14. + if (pledge("stdio rpath", NULL) == -1) {
  15. + fprintf ( stderr, "%s: pledge\n", progName );
  16. + exit ( 1 );
  17. + }
  18. + }
  19. break;
  20. case SM_F2F:
  21. @@ -1434,6 +1445,17 @@ void uncompress ( Char *name )
  22. setExit(1);
  23. return;
  24. };
  25. + if (numFileNames == 1) { /* stdout, and only one input file */
  26. + if (pledge("stdio", NULL) == -1) {
  27. + fprintf ( stderr, "%s: pledge\n", progName );
  28. + exit ( 1 );
  29. + }
  30. + } else {
  31. + if (pledge("stdio rpath", NULL) == -1) {
  32. + fprintf ( stderr, "%s: pledge\n", progName );
  33. + exit ( 1 );
  34. + }
  35. + }
  36. break;
  37. case SM_F2F:
  38. @@ -1781,6 +1803,11 @@ IntNative main ( IntNative argc, Char *argv[] )
  39. Cell *aa;
  40. Bool decode;
  41. + if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) {
  42. + fprintf ( stderr, "%s: pledge\n", progName );
  43. + exit ( 1 );
  44. + }
  45. +
  46. /*-- Be really really really paranoid :-) --*/
  47. if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 ||
  48. sizeof(Int16) != 2 || sizeof(UInt16) != 2 ||
  49. @@ -1958,6 +1985,10 @@ IntNative main ( IntNative argc, Char *argv[] )
  50. if (opMode == OM_Z) {
  51. if (srcMode == SM_I2O) {
  52. + if (pledge("stdio", NULL) == -1) { /* stdin -> stdout */
  53. + fprintf ( stderr, "%s: pledge\n", progName );
  54. + exit ( 1 );
  55. + }
  56. compress ( NULL );
  57. } else {
  58. decode = True;
  59. @@ -1974,6 +2005,10 @@ IntNative main ( IntNative argc, Char *argv[] )
  60. if (opMode == OM_UNZ) {
  61. unzFailsExist = False;
  62. if (srcMode == SM_I2O) {
  63. + if (pledge("stdio", NULL) == -1) { /* stdin -> stdout */
  64. + fprintf ( stderr, "%s: pledge\n", progName );
  65. + exit ( 1 );
  66. + }
  67. uncompress ( NULL );
  68. } else {
  69. decode = True;