Chromium Code Reviews| Index: src/trusted/desc/nacl_desc_io.c |
| diff --git a/src/trusted/desc/nacl_desc_io.c b/src/trusted/desc/nacl_desc_io.c |
| index 610232e4889a4258c3499671298d67e5c38c63fb..fbd21a852360bab2fa3afd85070369fdf96839e1 100644 |
| --- a/src/trusted/desc/nacl_desc_io.c |
| +++ b/src/trusted/desc/nacl_desc_io.c |
| @@ -90,6 +90,21 @@ struct NaClDescIoDesc *NaClDescIoDescMake(struct NaClHostDesc *nhdp) { |
| return ndp; |
| } |
| +struct NaClDesc *NaClDescIoDescMakeFromHandle(NaClHandle handle) { |
| + int posix_d; |
| + struct NaClHostDesc *nhdp; |
| + struct NaClDescIoDesc *desc; |
| + |
| +#if NACL_WINDOWS |
| + posix_d = _open_osfhandle((intptr_t) handle, _O_RDWR | _O_BINARY); |
|
Mark Seaborn
2013/03/22 18:40:05
You should check for an error here:
if (posix_d ==
hamaji
2013/03/22 18:45:08
Done.
|
| +#else |
| + posix_d = handle; |
| +#endif |
| + nhdp = NaClHostDescPosixMake(posix_d, NACL_ABI_O_RDWR); |
|
Mark Seaborn
2013/03/22 18:40:05
You should check for an error here too:
if (nhdp =
hamaji
2013/03/22 18:45:08
Done.
|
| + desc = NaClDescIoDescMake(nhdp); |
| + return &desc->base; |
| +} |
| + |
| struct NaClDescIoDesc *NaClDescIoDescOpen(char *path, |
| int mode, |
| int perms) { |