Pass descriptor number to write(2), now that it is possible.

This commit is contained in:
pjd 2011-03-09 22:50:15 +00:00
parent 7d5541f691
commit cf63dbabf1
2 changed files with 4 additions and 4 deletions

View File

@ -163,7 +163,7 @@ static struct syscall_desc syscalls[] = {
{ "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
{ "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } },
#endif
{ "write", ACTION_WRITE, { TYPE_NUMBER, TYPE_NONE } },
{ "write", ACTION_WRITE, { TYPE_NUMBER, TYPE_STRING, TYPE_NONE } },
{ NULL, -1, { TYPE_NONE } }
};
@ -745,7 +745,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
break;
#endif
case ACTION_WRITE:
rval = write(DESC(0), "x", 1);
rval = write(DESC(0), STR(1), strlen(STR(1)));
break;
default:
fprintf(stderr, "unsupported syscall\n");

View File

@ -18,13 +18,13 @@ cd ${n2}
# Check whether writing to the file by non-owner clears the SUID.
expect 0 create ${n0} 04777
expect 0 -u 65534 -g 65534 write ${n0} x
expect 0 -u 65534 -g 65534 open ${n0} O_WRONLY : write 0 x
expect 0777 stat ${n0} mode
expect 0 unlink ${n0}
# Check whether writing to the file by non-owner clears the SGID.
expect 0 create ${n0} 02777
expect 0 -u 65534 -g 65534 write ${n0} x
expect 0 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x
expect 0777 stat ${n0} mode
expect 0 unlink ${n0}