OpenSDE Packages Database (without history before r20070)
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.

142 lines
5.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/pkg/lvm2/lvm2-musl-0001-read-only-assignment.patch
  5. # Copyright (C) 2012 - 2014 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. lib/commands/toolcontext.c
  17. -------------------------------------------------------------------------------
  18. commands/toolcontext.c: In function 'create_toolcontext':
  19. commands/toolcontext.c:1427:4: error: assignment of read-only variable 'stdin'
  20. commands/toolcontext.c:1439:4: error: assignment of read-only variable 'stdout'
  21. commands/toolcontext.c: In function 'destroy_toolcontext':
  22. commands/toolcontext.c:1757:5: error: assignment of read-only variable 'stdin'
  23. commands/toolcontext.c:1767:5: error: assignment of read-only variable 'stdout'
  24. -------------------------------------------------------------------------------
  25. tools/lvmcmdline.c
  26. -------------------------------------------------------------------------------
  27. lvmcmdline.c: In function '_check_standard_fds':
  28. lvmcmdline.c:1255:6: error: assignment of read-only variable 'stdin'
  29. lvmcmdline.c:1265:6: error: assignment of read-only variable 'stdout'
  30. lvmcmdline.c:1273:6: error: assignment of read-only variable 'stderr'
  31. -------------------------------------------------------------------------------
  32. --- a/tools/lvmcmdline.c 2013-11-13 15:12:23.000000000 +0100
  33. +++ b/tools/lvmcmdline.c 2014-01-11 13:08:11.746838326 +0100
  34. @@ -1250,9 +1250,12 @@
  35. static int _check_standard_fds(void)
  36. {
  37. int err = is_valid_fd(STDERR_FILENO);
  38. + FILE *stdin_stream = stdin;
  39. + FILE *stdout_stream = stdout;
  40. + FILE *stderr_stream = stderr;
  41. if (!is_valid_fd(STDIN_FILENO) &&
  42. - !(stdin = fopen(_PATH_DEVNULL, "r"))) {
  43. + !(stdin_stream = fopen(_PATH_DEVNULL, "r"))) {
  44. if (err)
  45. perror("stdin stream open");
  46. else
  47. @@ -1262,7 +1265,7 @@
  48. }
  49. if (!is_valid_fd(STDOUT_FILENO) &&
  50. - !(stdout = fopen(_PATH_DEVNULL, "w"))) {
  51. + !(stdout_stream = fopen(_PATH_DEVNULL, "w"))) {
  52. if (err)
  53. perror("stdout stream open");
  54. /* else no stdout */
  55. @@ -1270,7 +1273,7 @@
  56. }
  57. if (!is_valid_fd(STDERR_FILENO) &&
  58. - !(stderr = fopen(_PATH_DEVNULL, "w"))) {
  59. + !(stderr_stream = fopen(_PATH_DEVNULL, "w"))) {
  60. printf("stderr stream open: %s\n",
  61. strerror(errno));
  62. return 0;
  63. --- a/lib/commands/toolcontext.c 2014-01-11 13:08:11.746838326 +0100
  64. +++ b/lib/commands/toolcontext.c 2014-01-11 18:43:42.136857198 +0100
  65. @@ -1373,6 +1373,8 @@
  66. {
  67. struct cmd_context *cmd;
  68. FILE *new_stream;
  69. + FILE *stdin_stream = stdin;
  70. + FILE *stdout_stream = stdout;
  71. int flags;
  72. #ifdef M_MMAP_MAX
  73. @@ -1422,10 +1424,10 @@
  74. if (is_valid_fd(STDIN_FILENO) &&
  75. ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
  76. (flags & O_ACCMODE) != O_WRONLY) {
  77. - if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
  78. + if (!_reopen_stream(stdin_stream, STDIN_FILENO, "r", "stdin", &new_stream))
  79. goto_out;
  80. - stdin = new_stream;
  81. - if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
  82. + stdin_stream = new_stream;
  83. + if (setvbuf(stdin_stream, cmd->linebuffer, _IOLBF, linebuffer_size)) {
  84. log_sys_error("setvbuf", "");
  85. goto out;
  86. }
  87. @@ -1434,10 +1436,10 @@
  88. if (is_valid_fd(STDOUT_FILENO) &&
  89. ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
  90. (flags & O_ACCMODE) != O_RDONLY) {
  91. - if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream))
  92. + if (!_reopen_stream(stdout_stream, STDOUT_FILENO, "w", "stdout", &new_stream))
  93. goto_out;
  94. - stdout = new_stream;
  95. - if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
  96. + stdout_stream = new_stream;
  97. + if (setvbuf(stdout_stream, cmd->linebuffer + linebuffer_size,
  98. _IOLBF, linebuffer_size)) {
  99. log_sys_error("setvbuf", "");
  100. goto out;
  101. @@ -1717,6 +1719,8 @@
  102. {
  103. struct dm_config_tree *cft_cmdline;
  104. FILE *new_stream;
  105. + FILE *stdin_stream = stdin;
  106. + FILE *stdout_stream = stdout;
  107. int flags;
  108. if (cmd->dump_filter && cmd->filter && cmd->filter->dump &&
  109. @@ -1753,9 +1757,9 @@
  110. if (is_valid_fd(STDIN_FILENO) &&
  111. ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
  112. (flags & O_ACCMODE) != O_WRONLY) {
  113. - if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) {
  114. - stdin = new_stream;
  115. - setlinebuf(stdin);
  116. + if (_reopen_stream(stdin_stream, STDIN_FILENO, "r", "stdin", &new_stream)) {
  117. + stdin_stream = new_stream;
  118. + setlinebuf(stdin_stream);
  119. } else
  120. cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
  121. }
  122. @@ -1763,9 +1767,9 @@
  123. if (is_valid_fd(STDOUT_FILENO) &&
  124. ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
  125. (flags & O_ACCMODE) != O_RDONLY) {
  126. - if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) {
  127. - stdout = new_stream;
  128. - setlinebuf(stdout);
  129. + if (_reopen_stream(stdout_stream, STDOUT_FILENO, "w", "stdout", &new_stream)) {
  130. + stdout_stream = new_stream;
  131. + setlinebuf(stdout_stream);
  132. } else
  133. cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
  134. }