No, you're wrong.
Your "cp -f" will _overwrite_ the already existing "uu" file. So the "cp"
is actually overwriting the old binary, and it prints out "u2" as a
result: which is exactly the expected behaviour of "fexecve()". If you
change the file itself, there's no way to execve() the old contents,
because the old contents simply do not exist. That's true of fexecve()
too.
To show what you want to show, you need to use "cp -fb" or something else
that actually _switches_ the file around from under you. Or make the
system() call do a "rm uu; cp uX uu". And if you do that, then you will
see "u1". Try it and see.
In other words, "execve(/proc/self/fd/xxx)" does work and is exactly the
same as fexecve().
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/