Commit f09a15d
start-stop-daemon.c: fix failure case on --notify fd:4
When the created notified pipe (often on 4) is the same number as
the notification fd target, dup2() does not clear the FD_CLOEXEC
flag, so the fd gets closed right when exec'ing the daemon,
reporting readiness failure. Fix this by explicitly testing for
the case and clearing the flag when necessary.
Note that this happens because of a call to close_range() right
before the test. close_range() is the real problem, it should
never be used and this bug is a perfect illustration of why; but
getting rid of close_range() is a much more invasive change that
I don't want to commit to right now, especially since navi's plan
is to eventually deprecate start-stop-daemon.1 parent aa456f3 commit f09a15d
1 file changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1130 | 1130 | | |
1131 | 1131 | | |
1132 | 1132 | | |
1133 | | - | |
| 1133 | + | |
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1140 | 1152 | | |
1141 | 1153 | | |
1142 | 1154 | | |
| |||
0 commit comments