Solved

Calling rm and unlink from C++ on Solaris 10

Posted on 2011-02-22
4
734 Views
Last Modified: 2013-12-27
We are having a problem consistently deleting files on a solaris 10 system. Briefly, we start a process which starts multiple other processes. These processes run as root. I'm not sure why. This is a legasy system and there is LOTS that is not clear. But I digress.

These root processes delete (using unlink) some files and then recreate them. When I do a run, SOMTIMES the user/group of these files is "nobody users" and SOMETIMES the user/group of these files is "dave users". We don't yet know why this happens.

The problem is that from run to run the files that are supposed to get deleted and then created again do not always get deleted. This is obviously because the owner is not correct.  So unlink is not doing what we need, deleting the files no matter what.

If, from a shell in the terminal window, I issue an "rm" command, I will get a y/n prompt and the file will be deleted if I say "y".

I am changing the code to do a system call to do an "rm -f", but I'm not really happy with this. Anyone have any idea what might be going on?

D. Scruggs

PS - I don't know how this ended up in the Web Development/PHP zone. It wasn't supposed to. Just ignore, if you can.
0
Comment
Question by:bcfd2104
  • 2
4 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 34956618
You have to look at the C++ code to see whether the process that runs has the drop in priviledge within.

When it spawns a process it might spawn it under a different user. one has to analyze the code to see what is going on.

you could run truss -f -p parent_process and see what it is doing.
0
 

Accepted Solution

by:
bcfd2104 earned 0 total points
ID: 34956625
I'll look into that, thanks.
0
 
LVL 2

Expert Comment

by:advega
ID: 35333653
Also, check who is the owner of the main binary (executable) file that you run, and if it has some sort of setuid permission on it.
0
 

Author Closing Comment

by:bcfd2104
ID: 35422415
I really didn't get an answer.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now