I was surprised by a hard link created suddenly between a config file that I (as usr1) own and a temporary file that I create in an OS daemon (each 5 minutes), to copy from the original config file.
After copying back to the original file, I use rename(*file2, *file1); in C which kills any trace to config.txt.tmp
The directory is root owned on a mnt /sram drive, and no one has a root access over the embedded machine. The storage media is NAND flash SRAM on embedded Linux 2.6.10
ls -l
shows
2 config.txt 699byte date_modify
2 config.txt.tmp 699byte date_modify
config.txt.tmp should get created, copied from config.txt, send config parameters to config.txt then gets deleted atomically within 5-7 C lines only
The directory is root owned, and there is no way to create hard links.
Anyone has an explanation of "hard link" creation in the low level functions? Could I be facing a race condition? Or could it be some kernel code for storage over flash? Or a bug in Linux?
My code ran over 5 years, 100 machines, and ONLY 1 machine recently got this problem.