Skip to content

Commit fc84eca

Browse files
committed
---
yaml --- r: 159767 b: refs/heads/auto c: b5286af h: refs/heads/master i: 159765: 5d4fa07 159763: 00abc7e 159759: ebf020e v: v3
1 parent 5ecfff3 commit fc84eca

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
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 5de56b3ca1defd9206db8364ecef5f3fd8cc5b38
13+
refs/heads/auto: b5286af703e33bd36744fe4cd5bb24f71dbb524e
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)