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 / host / tests / chown.om
| 1 | note chown: fchownat to the current uid (gid unchanged); st_uid low byte at 24, missing path errno. |
| 2 | text p "own.tmp" |
| 3 | text miss "no.such.file" |
| 4 | fn main to int |
| 5 | fd = int fopen p 0 len p 578 420 |
| 6 | if lt fd 0 |
| 7 | ret 1 |
| 8 | end |
| 9 | r = fclose fd |
| 10 | u = getuid |
| 11 | r = chown p 0 len p int u int -1 |
| 12 | if ne r 0 |
| 13 | ret 2 |
| 14 | end |
| 15 | st = new uchar 128 0 |
| 16 | r = stat p 0 len p st 0 128 |
| 17 | if ne r 0 |
| 18 | ret 3 |
| 19 | end |
| 20 | if ne int get st 24 int and u long 255 |
| 21 | ret 4 |
| 22 | end |
| 23 | r = chown miss 0 len miss int u int -1 |
| 24 | if ge r 0 |
| 25 | ret 5 |
| 26 | end |
| 27 | r = unlink p 0 len p |
| 28 | if ne r 0 |
| 29 | ret 6 |
| 30 | end |
| 31 | ret 0 |
| 32 | end |