Skip to content

Commit f88a1e6

Browse files
author
Jorge Aparicio
committed
std: undo conversion of user defined try!s
1 parent aa7fe93 commit f88a1e6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/libstd/sys/unix/process.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -335,25 +335,25 @@ impl Command {
335335
// have the drop glue anyway because this code never returns (the
336336
// child will either exec() or invoke libc::exit)
337337
unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error {
338-
macro_rules! try {
338+
macro_rules! t {
339339
($e:expr) => (match $e {
340340
Ok(e) => e,
341341
Err(e) => return e,
342342
})
343343
}
344344

345345
if let Some(fd) = stdio.stdin.fd() {
346-
cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO))?;
346+
t!(cvt_r(|| libc::dup2(fd, libc::STDIN_FILENO)));
347347
}
348348
if let Some(fd) = stdio.stdout.fd() {
349-
cvt_r(|| libc::dup2(fd, libc::STDOUT_FILENO))?;
349+
t!(cvt_r(|| libc::dup2(fd, libc::STDOUT_FILENO)));
350350
}
351351
if let Some(fd) = stdio.stderr.fd() {
352-
cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO))?;
352+
t!(cvt_r(|| libc::dup2(fd, libc::STDERR_FILENO)));
353353
}
354354

355355
if let Some(u) = self.gid {
356-
cvt(libc::setgid(u as gid_t))?;
356+
t!(cvt(libc::setgid(u as gid_t)));
357357
}
358358
if let Some(u) = self.uid {
359359
// When dropping privileges from root, the `setgroups` call
@@ -365,7 +365,7 @@ impl Command {
365365
// privilege dropping function.
366366
let _ = libc::setgroups(0, ptr::null());
367367

368-
cvt(libc::setuid(u as uid_t))?;
368+
t!(cvt(libc::setuid(u as uid_t)));
369369
}
370370
if self.session_leader {
371371
// Don't check the error of setsid because it fails if we're the
@@ -374,7 +374,7 @@ impl Command {
374374
let _ = libc::setsid();
375375
}
376376
if let Some(ref cwd) = self.cwd {
377-
cvt(libc::chdir(cwd.as_ptr()))?;
377+
t!(cvt(libc::chdir(cwd.as_ptr())));
378378
}
379379
if let Some(ref envp) = self.envp {
380380
*sys::os::environ() = envp.as_ptr();
@@ -390,17 +390,17 @@ impl Command {
390390
// need to clean things up now to avoid confusing the program
391391
// we're about to run.
392392
let mut set: libc::sigset_t = mem::uninitialized();
393-
cvt(libc::sigemptyset(&mut set))?;
394-
cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
395-
ptr::null_mut()))?;
393+
t!(cvt(libc::sigemptyset(&mut set)));
394+
t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
395+
ptr::null_mut())));
396396
let ret = libc::signal(libc::SIGPIPE, libc::SIG_DFL);
397397
if ret == libc::SIG_ERR {
398398
return io::Error::last_os_error()
399399
}
400400
}
401401

402402
for callback in self.closures.iter_mut() {
403-
callback()?;
403+
t!(callback());
404404
}
405405

406406
libc::execvp(self.argv[0], self.argv.as_ptr());

0 commit comments

Comments
 (0)