File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pub struct FromEnvError {
15
15
pub enum FromEnvErrorKind {
16
16
/// There is no environment variable that describes jobserver to inherit.
17
17
NoEnvVar ,
18
- /// There is no jobserver in the environment variable.
18
+ /// There is no jobserver in the environment variable, or it was disabled .
19
19
/// Variables associated with Make can be used for passing data other than jobserver info.
20
20
NoJobserver ,
21
21
/// Cannot parse jobserver environment variable value, incorrect format.
Original file line number Diff line number Diff line change @@ -123,13 +123,19 @@ impl Client {
123
123
Some ( w) => w,
124
124
None => return Ok ( None ) ,
125
125
} ;
126
- let read = read
126
+ let read: c_int = read
127
127
. parse ( )
128
128
. map_err ( |e| FromEnvErrorInner :: CannotParse ( format ! ( "cannot parse `read` fd: {e}" ) ) ) ?;
129
- let write = write
129
+ let write: c_int = write
130
130
. parse ( )
131
131
. map_err ( |e| FromEnvErrorInner :: CannotParse ( format ! ( "cannot parse `write` fd: {e}" ) ) ) ?;
132
132
133
+ // If either or both of these file descriptors are negative,
134
+ // it means the jobserver is disabled for this process.
135
+ if read < 0 || write < 0 {
136
+ return Err ( FromEnvErrorInner :: NoJobserver ) ;
137
+ }
138
+
133
139
// Ok so we've got two integers that look like file descriptors, but
134
140
// for extra sanity checking let's see if they actually look like
135
141
// valid files and instances of a pipe if feature enabled before we
You can’t perform that action at this time.
0 commit comments