How to change the application file of the application that is currently running (on Linux)?

I have an application called AppFS. This application has an ext2 file system just attached to the end of the file (it is positioned so that the application binary exists in a 1 MB distance, followed by ext2 data).

Now I have FUSE built into the program, and I was able to extract the file system from the application data into a temporary file so that FUSE mounts / uses it.

Now the problem is writing the temporary file back to the application file. I get a “text file busy”, presumably because the application has blocked itself and will not allow recording.

Is there a way to make the file unlock so I can write data? (It is important to note that I do not change the binary area of ​​the application - I simply rewrite the ext2 component.) It must be unlocked without requiring root privileges (unlocked by the same user who launched the application).

+3
source share
2 answers

The solution to this problem was to rename the existing application name (to a place in the temporary directory) and then move the new (generated) file back to it and apply the same umask / uid / gid that the old one was. After moving it, you can safely simply disconnect the executable file.

( , ), .

+1

:

  • AppFS
  • ( FS)
  • , ( FS)
  • ( - )

:

  • AppFS, 2, 3, 4 5 .

. SFX.

0

Source: https://habr.com/ru/post/1748796/


All Articles