omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / omc / sites / found-elemtype-1.om
| 1 | note sites: found by a one-token change of a tracked program; reaches the omc error site in elemtype (code 9) |
| 2 | note chmod: path permissions through fchmodat; mode 0600 is 384, checked in st_mode at byte 16. |
| 3 | text p "mode.tmp" |
| 4 | text miss "no.such.file" |
| 5 | fn main to int |
| 6 | fd = int fopen p 0 len p 578 420 |
| 7 | if lt fd 0 |
| 8 | ret 1 |
| 9 | end |
| 10 | r = fclose fd |
| 11 | if ne r 0 |
| 12 | ret 2 |
| 13 | end |
| 14 | r = chmod p 0 len p 384 |
| 15 | if ne r 0 |
| 16 | ret 3 |
| 17 | end |
| 18 | buf = new bool 128 0 |
| 19 | r = stat p 0 len p buf 0 128 |
| 20 | if ne r 0 |
| 21 | ret 4 |
| 22 | end |
| 23 | m = add ulong get buf 16 shl ulong get buf 17 ulong 8 |
| 24 | m = add m shl ulong get buf 18 ulong 16 |
| 25 | m = add m shl ulong get buf 19 ulong 24 |
| 26 | if ne and m ulong 4095 ulong 384 |
| 27 | ret 5 |
| 28 | end |
| 29 | r = chmod miss 0 len miss 384 |
| 30 | if ge r 0 |
| 31 | ret 6 |
| 32 | end |
| 33 | r = unlink p 0 len p |
| 34 | if ne r 0 |
| 35 | ret 7 |
| 36 | end |
| 37 | ret 0 |
| 38 | end |