Monday, December 14, 2015

symbolic link affecting program behaviour

symbolic links affect program behaviour ? how?

In a C program, the command line is stored in argv, which is short for argument vector.

The progam's name is the first element of argv, i.e. argv[0].

Clearly in the case of halt and reboot, the program is changing its behavior based on argv[0].

# reboot

ps -p -o cmd or cat /proc/cmdline.

so in program depending upon argv[0] behaviour changes !


No comments:

Post a Comment