Skip to content

Commit

Permalink
{R,W,X,F}_OK are not constants for the Cosmopolitan libc
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosaure committed Feb 6, 2023
1 parent c04f7b0 commit 1329ebe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/unix/unix_c/unix_access_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
| Converters |
+-----------------------------------------------------------------+ */

/* Table mapping constructors of ocaml type Unix.access_permission to C values. */
static int access_permission_table[] = {
/* Constructor R_OK. */
R_OK,
/* Constructor W_OK. */
W_OK,
/* Constructor X_OK. */
X_OK,
/* Constructor F_OK. */
F_OK
};

/* Convert ocaml values of type Unix.access_permission to a C int. */
static int int_of_access_permissions(value list)
{
/* Table mapping constructors of ocaml type Unix.access_permission to C values. */
int access_permission_table[] = {
/* Constructor R_OK. */
R_OK,
/* Constructor W_OK. */
W_OK,
/* Constructor X_OK. */
X_OK,
/* Constructor F_OK. */
F_OK
};

int result = 0;
while (list != Val_emptylist) {
result |= access_permission_table[Int_val(Field(list, 0))];
Expand Down

0 comments on commit 1329ebe

Please sign in to comment.