Re: [systemd-devel] [PATCH] config_parse_set_status: put signals in the correct set

2015-02-01 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Jan 30, 2015 at 09:49:55AM +0100, Michael Olbrich wrote:
 This was broken when the code was rearranged in 1e2fd62d70ff
 core/load-fragment.c: correct argument sign and split up long lines
With this change, the new code is similarly complicated as the old code,
so a (partial) revert would have worked too. But the patch is OK.

Applied.

Zbyszek


 ---
  src/core/load-fragment.c | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)
 
 diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
 index 516731aba26c..571bb64b7824 100644
 --- a/src/core/load-fragment.c
 +++ b/src/core/load-fragment.c
 @@ -3150,6 +3150,7 @@ int config_parse_set_status(
  FOREACH_WORD(word, l, rvalue, state) {
  _cleanup_free_ char *temp;
  int val;
 +Set **set;
  
  temp = strndup(word, l);
  if (!temp)
 @@ -3162,21 +3163,23 @@ int config_parse_set_status(
  if (val = 0) {
  log_syntax(unit, LOG_ERR, filename, line, 
 -val,
 Failed to parse value, ignoring: 
 %s, word);
 -return 0;
 +continue;
  }
 +set = status_set-signal;
  } else {
  if (val  0 || val  255) {
  log_syntax(unit, LOG_ERR, filename, line, 
 ERANGE,
 Value %d is outside range 0-255, 
 ignoring, val);
  continue;
  }
 +set = status_set-status;
  }
  
 -r = set_ensure_allocated(status_set-status, NULL);
 +r = set_ensure_allocated(set, NULL);
  if (r  0)
  return log_oom();
  
 -r = set_put(status_set-status, INT_TO_PTR(val));
 +r = set_put(*set, INT_TO_PTR(val));
  if (r  0) {
  log_syntax(unit, LOG_ERR, filename, line, -r,
 Unable to store: %s, word);
 -- 
 2.1.4
 
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] config_parse_set_status: put signals in the correct set

2015-01-30 Thread Michael Olbrich
This was broken when the code was rearranged in 1e2fd62d70ff
core/load-fragment.c: correct argument sign and split up long lines
---
 src/core/load-fragment.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 516731aba26c..571bb64b7824 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -3150,6 +3150,7 @@ int config_parse_set_status(
 FOREACH_WORD(word, l, rvalue, state) {
 _cleanup_free_ char *temp;
 int val;
+Set **set;
 
 temp = strndup(word, l);
 if (!temp)
@@ -3162,21 +3163,23 @@ int config_parse_set_status(
 if (val = 0) {
 log_syntax(unit, LOG_ERR, filename, line, -val,
Failed to parse value, ignoring: 
%s, word);
-return 0;
+continue;
 }
+set = status_set-signal;
 } else {
 if (val  0 || val  255) {
 log_syntax(unit, LOG_ERR, filename, line, 
ERANGE,
Value %d is outside range 0-255, 
ignoring, val);
 continue;
 }
+set = status_set-status;
 }
 
-r = set_ensure_allocated(status_set-status, NULL);
+r = set_ensure_allocated(set, NULL);
 if (r  0)
 return log_oom();
 
-r = set_put(status_set-status, INT_TO_PTR(val));
+r = set_put(*set, INT_TO_PTR(val));
 if (r  0) {
 log_syntax(unit, LOG_ERR, filename, line, -r,
Unable to store: %s, word);
-- 
2.1.4

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel