Raymond Toy pushed to branch issue-269-unix-get-user-homedir at cmucl / cmucl
Commits:
-
a24b478f
by Raymond Toy at 2023-11-29T16:15:10-08:00
1 changed file:
Changes:
... | ... | @@ -67,18 +67,23 @@ |
67 | 67 | if no errors occurred. Otherwise a non-zero value is returned.
|
68 | 68 | Examining errno may give information about what failed."
|
69 | 69 | (alien:with-alien ((status c-call:int))
|
70 | - (let ((result
|
|
71 | - (alien:alien-funcall
|
|
72 | - (alien:extern-alien "os_get_user_homedir"
|
|
73 | - (function c-call:c-string
|
|
74 | - c-call:c-string
|
|
75 | - (* c-call:int)))
|
|
76 | - name
|
|
77 | - (alien:addr status))))
|
|
78 | - (if (and (zerop status) result)
|
|
79 | - (values (pathname
|
|
80 | - (concatenate 'string
|
|
81 | - result
|
|
82 | - "/"))
|
|
83 | - status)
|
|
84 | - (values result status))))) |
|
70 | + (let (result)
|
|
71 | + (unwind-protect
|
|
72 | + (progn
|
|
73 | + (setf result
|
|
74 | + (alien:alien-funcall
|
|
75 | + (alien:extern-alien "os_get_user_homedir"
|
|
76 | + (function (alien:* c-call:c-string)
|
|
77 | + c-call:c-string
|
|
78 | + (* c-call:int)))
|
|
79 | + name
|
|
80 | + (alien:addr status)))
|
|
81 | + (if (and (zerop status)
|
|
82 | + (not (alien:null-alien result)))
|
|
83 | + (values (pathname
|
|
84 | + (concatenate 'string
|
|
85 | + (alien:cast result c-call:c-string)
|
|
86 | + "/"))
|
|
87 | + status)
|
|
88 | + (values nil status)))
|
|
89 | + (alien:free-alien result))))) |