properly handle return codes
[project/rpcd.git] / file.c
diff --git a/file.c b/file.c
index 31a937d..3831c54 100644 (file)
--- a/file.c
+++ b/file.c
@@ -221,7 +221,7 @@ rpc_file_write(struct ubus_context *ctx, struct ubus_object *obj,
        if (!tb[RPC_F_RW_PATH] || !tb[RPC_F_RW_DATA])
                return UBUS_STATUS_INVALID_ARGUMENT;
 
-       if ((fd = open(blobmsg_data(tb[RPC_F_RW_PATH]), O_CREAT | O_TRUNC | O_WRONLY)) < 0)
+       if ((fd = open(blobmsg_data(tb[RPC_F_RW_PATH]), O_CREAT | O_TRUNC | O_WRONLY, 0666)) < 0)
                return rpc_errno_status();
 
        if (write(fd, blobmsg_data(tb[RPC_F_RW_DATA]), blobmsg_data_len(tb[RPC_F_RW_DATA])) < 0)