syscalls: 'getxattr' throws upon error.

* guix/build/syscalls.scm (getxattr): Throw in the negative SIZE case.
This commit is contained in:
Ludovic Courtès 2023-03-27 12:01:05 +02:00
parent 30cc651fba
commit 836297eae5
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -970,7 +970,10 @@ (define getxattr
(string->pointer key)
(string->pointer "")
0)))
(cond ((< size 0) #f)
(cond ((< size 0)
(throw 'system-error "getxattr" "~S: ~A"
(list file key (strerror err))
(list err)))
((zero? size) "")
;; Get VALUE in buffer of SIZE. XXX actual size can race.
(else (let*-values (((buf) (make-bytevector size))