data fork problem

Hi All,
I have an  application that locks a file by puting some informations at the beginning of its data fork.
so it can,t be open by another application.
My question is :
I s there any way to prevent  the application from doing so?


Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

brettmjohnsonConnect With a Mentor Commented:
I you lock the file yourself (before the other application does so), using the same locking mechanism,
you will prevent the other app from locking the file.  However that will probably adversely affect
the application in question ( it will probably either wait for the lock to be released, or generate
and error, or simply exit).   Your posts indicate that your goal is to "fool" the application into thinking
it locked the file without actually doing so.  Keep in mind that the application likely uses file locking to
coordinate activity and/or prevent data corruption.

You have apparently asked us how to do something that seems unwise.  Perhaps we need to understand
what the greater goal is.   Why do you wish to disable application file locking?  What are you trying
to accomplish?
bachra04Author Commented:
This does not resolve the problem because my purpose is to eliminate the locking mechanism implemented by this application (of course I dispose only with the executable of this application).
So is it it possible to protect only one part (let's say the first 256 bits) of data fork from writing.
and make them read only.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Both lockf() and fcntl() provide for locking regions of files - specified as a range of bytes 256 bits == 64 bytes.

bachra04Author Commented:
Thank you for your comments ,
As you've said lockf and fcntl provide locking region but this didn't help me prevent the locking action of the application.
What I think is that application uses flock () to provide exclusif access.
My last action :
Is there a way to prevent or to fail the action of flock() programmatically ?
At the documentation I see that flock may be failed  by signals
"Processes blocked awaiting a lock may be awakened by signals."
So is it possible to do that by programming.

In conclusion:
The first application open a data file and locks it for its exclusif use.
I want my application to open the same file at this moment and remove the locking so I can write on it Is this possible?

Thank you again


bachra04Author Commented:
#Your posts indicate that your goal is to "fool" the application into thinking
#it locked the file without actually doing so.  

yes this is exactely what I want to do.

#Keep in mind that the application likely uses file locking to
#coordinate activity and/or prevent data corruption.

I agree with you but I planned to take care of that from my application.

My Goal is to convert a standalone application to pseudo centralized application.
But it seems impossible
All Courses

From novice to tech pro — start learning today.