Re: Write to executable which has done execve



On Aug 11, 5:30 pm, Bronson <psh...@xxxxxxxxx> wrote:

i am trying to make a program, which will exec another app and this
app will write to the main's program executable. I make execve
(precisely execlp) and try to open old file for writing in new
process. But I returns me ETXTBSY. Why? For example access says, that
i can write to file, but fopen fails with ETXTBSY...
What can i do with that...

You can't do it that way. You cannot modify a program's running image
by modifying the executable file. If you could, self-modifying code
would not work properly.

DS

.



Relevant Pages

  • Re: Write to executable which has done execve
    ... app will write to the main's program executable. ... and try to open old file for writing in new ... Only execve (no forks - checked ...
    (comp.os.linux.misc)
  • Re: Write to executable which has done execve
    ... app will write to the main's program executable. ... app execve to udpate app, update download new app to temp file. ... why writing to executable fails now. ...
    (comp.unix.programmer)
  • Simple question about mmap() system call
    ... I'm writing an utility that should examine some bytes of a large file ... and modify them - that't all. ... I've decided to mmap() the file: ... void *diskp; ...
    (freebsd-hackers)
  • Multithreading Interface Problem
    ... I'm writing a multithreaded application that uses 2 threads: ... modify the interface to reflect its busy state. ... processing I can't undo the changes because 'Controls created on one thread ... I use .NET Framework version 1.1 ...
    (microsoft.public.dotnet.languages.csharp)
  • Self-modifying Code
    ... when I was young I programmed in an interpreted language that allowed ... to modify itself. ... Also Python can (writing and running a module, ...
    (comp.lang.python)