Skip to content

Commit 13f4fe2

Browse files
committed
---
yaml --- r: 160186 b: refs/heads/snap-stage3 c: b5286af h: refs/heads/master v: v3
1 parent b4436f7 commit 13f4fe2

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: bfaa7bcab3459907014c31d3bf980f65ccd14b08
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5de56b3ca1defd9206db8364ecef5f3fd8cc5b38
4+
refs/heads/snap-stage3: b5286af703e33bd36744fe4cd5bb24f71dbb524e
55
refs/heads/try: 225de0d60f8ca8dcc62ab2fd8818ebbda4b58cfe
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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)