Skip to content

Commit 3d6f604

Browse files
committed
---
yaml --- r: 161055 b: refs/heads/try c: b5286af h: refs/heads/master i: 161053: deb4df9 161051: 364a758 161047: 5599a57 161039: 7b22319 161023: ef5e5db v: v3
1 parent 3099451 commit 3d6f604

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c9f6d696420107f82304b992cf623b806995fe18
5-
refs/heads/try: 5de56b3ca1defd9206db8364ecef5f3fd8cc5b38
5+
refs/heads/try: b5286af703e33bd36744fe4cd5bb24f71dbb524e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libstd/os.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ pub fn setenv<T: BytesContainer>(n: &str, v: T) {
422422
with_env_lock(|| {
423423
n.with_c_str(|nbuf| {
424424
v.with_c_str(|vbuf| {
425-
libc::funcs::posix01::unistd::setenv(nbuf, vbuf, 1);
425+
if libc::funcs::posix01::unistd::setenv(nbuf, vbuf, 1) != 0 {
426+
panic!(IoError::last_error());
427+
}
426428
})
427429
})
428430
})
@@ -438,7 +440,9 @@ pub fn setenv<T: BytesContainer>(n: &str, v: T) {
438440

439441
unsafe {
440442
with_env_lock(|| {
441-
libc::SetEnvironmentVariableW(n.as_ptr(), v.as_ptr());
443+
if libc::SetEnvironmentVariableW(n.as_ptr(), v.as_ptr()) == 0 {
444+
panic!(IoError::last_error());
445+
}
442446
})
443447
}
444448
}
@@ -453,7 +457,9 @@ pub fn unsetenv(n: &str) {
453457
unsafe {
454458
with_env_lock(|| {
455459
n.with_c_str(|nbuf| {
456-
libc::funcs::posix01::unistd::unsetenv(nbuf);
460+
if libc::funcs::posix01::unistd::unsetenv(nbuf) != 0 {
461+
panic!(IoError::last_error());
462+
}
457463
})
458464
})
459465
}
@@ -465,11 +471,14 @@ pub fn unsetenv(n: &str) {
465471
n.push(0);
466472
unsafe {
467473
with_env_lock(|| {
468-
libc::SetEnvironmentVariableW(n.as_ptr(), ptr::null());
474+
if libc::SetEnvironmentVariableW(n.as_ptr(), ptr::null()) == 0 {
475+
panic!(IoError::last_error());
476+
}
469477
})
470478
}
471479
}
472-
_unsetenv(n);
480+
481+
_unsetenv(n)
473482
}
474483

475484
/// Parses input according to platform conventions for the `PATH`

0 commit comments

Comments
 (0)