[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GNUNET_OS_start_process and process arguments
From: |
Alessio Vanni |
Subject: |
GNUNET_OS_start_process and process arguments |
Date: |
Sun, 13 Dec 2020 16:32:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hello,
I noticed a curious situation, best explained by this example:
Let's say I have a program (let's call it 'gnunet-exec') that starts a
process using `GNUNET_OS_start_process', with the program file name
taken from the command line and using the two strings "hello" and
"world" as arguments to the process.
Let's also say I have this small program:
int main(int argc, char *argv[]) {
printf("[%s] [%s] [%s]\n", argv[0], argv[1], argv[2]);
return 0;
}
I then get this result ($ is the shell prompt):
$ ./small-program hello world
[small-program] [hello] [world]
$ gnunet-exec small-program
[hello] [world] [(null)]
Essentially, argv[0] becomes the first argument instead of containing
the program name.
Is this intentional or is it a bug?
Thanks,
A.V.
- GNUNET_OS_start_process and process arguments,
Alessio Vanni <=