build: syscalls: Properly handle clone errors.

* guix/build/syscalls.scm (clone): Catch -1 return value and throw error.
This commit is contained in:
David Thompson 2015-09-05 13:36:53 -04:00
parent b7d0b096b0
commit cf897cbacc
1 changed files with 7 additions and 1 deletions

View File

@ -325,7 +325,13 @@ string TMPL and return its file name. TMPL must end with 'XXXXXX'."
"Create a new child process by duplicating the current parent process.
Unlike the fork system call, clone accepts FLAGS that specify which resources
are shared between the parent and child processes."
(proc syscall-id flags %null-pointer))))
(let ((ret (proc syscall-id flags %null-pointer))
(err (errno)))
(if (= ret -1)
(throw 'system-error "clone" "~d: ~A"
(list flags (strerror err))
(list err))
ret)))))
(define setns
;; Some systems may be using an old (pre-2.14) version of glibc where there