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.

137 lines
4.5 KiB

  1. From d401b23149a89fc14806dc8c347f2a85205a95cd Mon Sep 17 00:00:00 2001
  2. From: Philip Prindeville <philipp@redfish-solutions.com>
  3. Date: Mon, 26 Jun 2017 18:34:04 -0600
  4. Subject: [PATCH v1 1/1] Cleanup calls to message() containing newlines
  5. To: Philipp Rumpf <prumpf@mandrakesoft.com>, Jeff Garzik <jgarzik@pobox.com>, Henrique de Moraes Holschuh <hmh@debian.org>, Andrew Morton <akpm@linux-foundation.org>
  6. Cc: Philip Prindeville <philipp@redfish-solutions.com>
  7. Newlines are added automatically by logging daemons, and having
  8. embedded newlines can cause extra blank lines in syslog-ng,
  9. busybox, etc.
  10. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
  11. ---
  12. rngd.c | 8 ++++----
  13. rngd_entsource.c | 6 +++---
  14. rngd_linux.c | 2 +-
  15. rngd_rdrand.c | 6 +++---
  16. 4 files changed, 11 insertions(+), 11 deletions(-)
  17. diff --git a/rngd.c b/rngd.c
  18. index 0205d40e0abb970fb126460306398388bd7462a0..f10198682a14f2f1460100a1d274ad0d724cb326 100644
  19. --- a/rngd.c
  20. +++ b/rngd.c
  21. @@ -271,7 +271,7 @@ static void do_loop(int random_step)
  22. } else if (iter->failures >= MAX_RNG_FAILURES) {
  23. if (!arguments->quiet)
  24. message(LOG_DAEMON|LOG_ERR,
  25. - "too many FIPS failures, disabling entropy source\n");
  26. + "too many FIPS failures, disabling entropy source");
  27. iter->disabled = true;
  28. }
  29. }
  30. @@ -282,7 +282,7 @@ static void do_loop(int random_step)
  31. if (!arguments->quiet)
  32. message(LOG_DAEMON|LOG_ERR,
  33. - "No entropy sources working, exiting rngd\n");
  34. + "No entropy sources working, exiting rngd");
  35. }
  36. static void term_signal(int signo)
  37. @@ -317,7 +317,7 @@ int main(int argc, char **argv)
  38. message(LOG_DAEMON|LOG_ERR,
  39. "can't open any entropy source");
  40. message(LOG_DAEMON|LOG_ERR,
  41. - "Maybe RNG device modules are not loaded\n");
  42. + "Maybe RNG device modules are not loaded");
  43. }
  44. return 1;
  45. }
  46. @@ -337,7 +337,7 @@ int main(int argc, char **argv)
  47. && (rc_tpm || !arguments->enable_tpm)) {
  48. if (!arguments->quiet)
  49. message(LOG_DAEMON|LOG_ERR,
  50. - "No entropy source available, shutting down\n");
  51. + "No entropy source available, shutting down");
  52. return 1;
  53. }
  54. diff --git a/rngd_entsource.c b/rngd_entsource.c
  55. index f0e219d7af674204e5bdcf96e9045c40717872c3..8c1d7cb33159c9a0e03a4ea83f3a3358c706e2e3 100644
  56. --- a/rngd_entsource.c
  57. +++ b/rngd_entsource.c
  58. @@ -64,7 +64,7 @@ int xread(void *buf, size_t size, struct rng *ent_src)
  59. }
  60. if (size) {
  61. - message(LOG_DAEMON|LOG_ERR, "read error\n");
  62. + message(LOG_DAEMON|LOG_ERR, "read error");
  63. return -1;
  64. }
  65. return 0;
  66. @@ -114,7 +114,7 @@ int xread_tpm(void *buf, size_t size, struct rng *ent_src)
  67. sizeof(rng_cmd) - r);
  68. if (retval < 0) {
  69. message(LOG_ERR|LOG_INFO,
  70. - "Error writing %s\n",
  71. + "Error writing %s",
  72. ent_src->rng_name);
  73. retval = -1;
  74. goto error_out;
  75. @@ -123,7 +123,7 @@ int xread_tpm(void *buf, size_t size, struct rng *ent_src)
  76. }
  77. if (r < sizeof(rng_cmd)) {
  78. message(LOG_ERR|LOG_INFO,
  79. - "Error writing %s\n", ent_src->rng_name);
  80. + "Error writing %s", ent_src->rng_name);
  81. retval = -1;
  82. goto error_out;
  83. }
  84. diff --git a/rngd_linux.c b/rngd_linux.c
  85. index c4f45dedecad0fd3bf80a35d7c240b917bf5ffdd..481c6bb15def3f06989766988b61f35d91207b58 100644
  86. --- a/rngd_linux.c
  87. +++ b/rngd_linux.c
  88. @@ -131,7 +131,7 @@ void random_add_entropy(void *buf, size_t size)
  89. memcpy(entropy.data, buf, size);
  90. if (ioctl(random_fd, RNDADDENTROPY, &entropy) != 0) {
  91. - message(LOG_DAEMON|LOG_ERR, "RNDADDENTROPY failed: %s\n",
  92. + message(LOG_DAEMON|LOG_ERR, "RNDADDENTROPY failed: %s",
  93. strerror(errno));
  94. exit(1);
  95. }
  96. diff --git a/rngd_rdrand.c b/rngd_rdrand.c
  97. index 4d7a5a7b3f52c3af8e677d3c4d758d4d235f1dd6..c1919d538428a8647dbce88d7d76384761e5b6cc 100644
  98. --- a/rngd_rdrand.c
  99. +++ b/rngd_rdrand.c
  100. @@ -162,7 +162,7 @@ static inline int gcrypt_mangle(unsigned char *tmp)
  101. if (gcry_error) {
  102. message(LOG_DAEMON|LOG_ERR,
  103. - "gcry_cipher_encrypt error: %s\n",
  104. + "gcry_cipher_encrypt error: %s",
  105. gcry_strerror(gcry_error));
  106. return -1;
  107. }
  108. @@ -257,7 +257,7 @@ static int init_gcrypt(const void *key)
  109. if (!gcry_check_version(MIN_GCRYPT_VERSION)) {
  110. message(LOG_DAEMON|LOG_ERR,
  111. - "libgcrypt version mismatch: have %s, require >= %s\n",
  112. + "libgcrypt version mismatch: have %s, require >= %s",
  113. gcry_check_version(NULL), MIN_GCRYPT_VERSION);
  114. return 1;
  115. }
  116. @@ -278,7 +278,7 @@ static int init_gcrypt(const void *key)
  117. if (gcry_error) {
  118. message(LOG_DAEMON|LOG_ERR,
  119. - "could not set key or IV: %s\n",
  120. + "could not set key or IV: %s",
  121. gcry_strerror(gcry_error));
  122. gcry_cipher_close(gcry_cipher_hd);
  123. return 1;
  124. --
  125. 2.7.4