Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/unix.lisp
    ... ... @@ -2053,9 +2053,7 @@
    2053 2053
       _N"Returns a string describing the error number which was returned by a
    
    2054 2054
       UNIX system call."
    
    2055 2055
       (declare (type integer error-number))
    
    2056
    -  (if (array-in-bounds-p *unix-errors* error-number)
    
    2057
    -      (svref *unix-errors* error-number)
    
    2058
    -      (format nil _"Unknown error [~d]" error-number)))
    
    2056
    +  (unix::unix-strerror error-number))
    
    2059 2057
     
    
    2060 2058
     
    
    2061 2059
     ;;;; Lisp types used by syscalls.
    
    ... ... @@ -2975,3 +2973,14 @@
    2975 2973
     	(if (null-alien result)
    
    2976 2974
     	    (values nil (unix-errno))
    
    2977 2975
     	    (%file->name (cast result c-call:c-string)))))))
    
    2976
    +
    
    2977
    +(defun unix-strerror (errno)
    
    2978
    +  _N"Returns a string that describes the error code Errno"
    
    2979
    +  (let ((result
    
    2980
    +	  (alien-funcall
    
    2981
    +	   (extern-alien "strerror"
    
    2982
    +			 (function (* char) int))
    
    2983
    +	   errno)))
    
    2984
    +    ;; Result from strerror can be localized so we need to decode
    
    2985
    +    ;; those octets to get a proper Lisp string.
    
    2986
    +    (string-decode (cast result c-string) :default)))