Thread: explanation of how this works

  1. #1
    Registered User
    Join Date
    Oct 2001

    explanation of how this works

    int main()
            int i;
    ok there is a program called ps2 and when ran it makes a file called ps2.tmp and the object i think is to make a symlink to the pass program before the ps2 program deletes it.... ok my problem is i dont know how or why this works (especially the unlink() symlink() and the & in the system()... or why this program doesnt need any headers to be included to compile?? (i just compiled it like shown above and it works??))

    i also did a search on symlink and unlink but that didnt help too much

    any help is greatly appreciated

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    I am my school right now and I don't know what ps2 is off of my head, but I do know unlink is like delete(in simple terms) and symlink creates a symbolic link without C in the terminal it would look like this(assuming /usr/bin) is in your path)
    rm /var/tmp2/ps2.tmp -f
    ln -s /bin/pass /var/tmp2/ps2.tmp
    1. the first line uses the program ps2 and puts it in the background so you still have a free terminal
    2. the second line deletes the .tmp file
    3. the last line creates a "pointer" to the file. YOu can delete the symbolic link but the original file is still the same.

    Do you understand it especially the symlink. It is a nice concept.

  3. #3
    Registered User
    Join Date
    Oct 2001
    ok but why does it need to be unlinked first?

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Hacking techniques, such as race conditions that you're attempting, will not be discussed here. Check the forum guidelines. PM me if you have questions about our rules.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can anybody show me why this works??
    By tzuch in forum C Programming
    Replies: 2
    Last Post: 03-29-2008, 09:03 AM
  2. Linked Lists
    By Bleu_Cheese in forum C++ Programming
    Replies: 13
    Last Post: 12-21-2007, 09:17 PM
  3. Works in MSVC++ 6.0 but not in Dev-C++
    By smitsky in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2004, 08:07 PM
  4. fprintf works in one function but not in the other.
    By smegly in forum C Programming
    Replies: 11
    Last Post: 05-25-2004, 03:30 PM
  5. Global hook only works on one window?
    By CornedBee in forum Windows Programming
    Replies: 5
    Last Post: 01-19-2004, 12:25 PM