Re: [OE-core] [PATCH 5/6] pseudo_client: Make msg static in pseudo_op_client

2021-09-09 Thread Seebs
On Thu,  9 Sep 2021 16:36:13 +0100
Richard Purdie  wrote:

> - pseudo_msg_t msg = { .type = PSEUDO_MSG_OP };
> + static pseudo_msg_t msg;
> + msg = (pseudo_msg_t) { .type = PSEUDO_MSG_OP };

Looks good to me.

I'm honestly sort of stunned that the return of the local variable's
address caused a problem, even though it's theoretically undefined,
because it's only ever checked against is-null, but I'm also sort of
stunned that I got away with it for that long.

-s

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155862): 
https://lists.openembedded.org/g/openembedded-core/message/155862
Mute This Topic: https://lists.openembedded.org/mt/85487319/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH 5/6] pseudo_client: Make msg static in pseudo_op_client

2021-09-09 Thread Richard Purdie
The address of msg is returned by the function in the OP_CHROOT case.
Whilst the way it is used means it is just a way of saying true/false,
the compiler doesn't know this and can warn and this isn't really
allowed.

The other pseudo funcitons in this area already use a static msg so
make this function match the others. There wouldn't be re-enterancy
in this context.

Need to be careful about clearing the data upon each function entry
and not just once at init.

Signed-off-by: Richard Purdie 
---
 pseudo_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pseudo_client.c b/pseudo_client.c
index 2583bca..546bdb1 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1589,7 +1589,8 @@ int pseudo_client_ignore_path(const char *path) {
 pseudo_msg_t *
 pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char 
*path, const PSEUDO_STATBUF *buf, ...) {
pseudo_msg_t *result = 0;
-   pseudo_msg_t msg = { .type = PSEUDO_MSG_OP };
+   static pseudo_msg_t msg;
+   msg = (pseudo_msg_t) { .type = PSEUDO_MSG_OP };
size_t pathlen = -1;
int do_request = 0;
char *path_extra_1 = 0;
-- 
2.32.0


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155859): 
https://lists.openembedded.org/g/openembedded-core/message/155859
Mute This Topic: https://lists.openembedded.org/mt/85487319/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-