@@ -183,18 +183,16 @@ impl Command {
183
183
cvt ( libc:: setgid ( u as gid_t ) ) ?;
184
184
}
185
185
if let Some ( u) = self . get_uid ( ) {
186
+ // When dropping privileges from root, the `setgroups` call
187
+ // will remove any extraneous groups. If we don't call this,
188
+ // then even though our uid has dropped, we may still have
189
+ // groups that enable us to do super-user things. This will
190
+ // fail if we aren't root, so don't bother checking the
191
+ // return value, this is just done as an optimistic
192
+ // privilege dropping function.
186
193
//FIXME: Redox kernel does not support setgroups yet
187
- if cfg ! ( not( target_os = "redox" ) ) {
188
- // When dropping privileges from root, the `setgroups` call
189
- // will remove any extraneous groups. If we don't call this,
190
- // then even though our uid has dropped, we may still have
191
- // groups that enable us to do super-user things. This will
192
- // fail if we aren't root, so don't bother checking the
193
- // return value, this is just done as an optimistic
194
- // privilege dropping function.
195
- let _ = libc:: setgroups ( 0 , ptr:: null ( ) ) ;
196
- }
197
-
194
+ #[ cfg( not( target_os = "redox" ) ) ]
195
+ let _ = libc:: setgroups ( 0 , ptr:: null ( ) ) ;
198
196
cvt ( libc:: setuid ( u as uid_t ) ) ?;
199
197
}
200
198
}
0 commit comments