Unix.setsid: guard against errors (#9958)
The return value of `setsid()` was not checked for errors.master
parent
e87b7ce437
commit
8806ddcbba
3
Changes
3
Changes
|
@ -292,6 +292,9 @@ Working version
|
|||
(Ivan Gotovchits and Xavier Leroy, review by Sébastien Hinderer and
|
||||
David Allsopp)
|
||||
|
||||
- #9958: Raise exception in case of error in Unix.setsid.
|
||||
(Nicolás Ojeda Bär, review by Stephen Dolan)
|
||||
|
||||
### Tools:
|
||||
|
||||
- #9551: ocamlobjinfo is now able to display information on .cmxs shared
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
CAMLprim value unix_setsid(value unit)
|
||||
{
|
||||
#ifdef HAS_SETSID
|
||||
return Val_int(setsid());
|
||||
pid_t pid = setsid();
|
||||
if (pid == (pid_t)(-1)) uerror("setsid", Nothing);
|
||||
return Val_long(pid);
|
||||
#else
|
||||
caml_invalid_argument("setsid not implemented");
|
||||
return Val_unit;
|
||||
|
|
Loading…
Reference in New Issue