0

I know /proc is a VFS and cannot be updated by user from shell prompt. this is my understanding from the beginning. Now , I am writing one code and where I am taking care of corrupted /proc/partitions file. I have my code ready and need to corrupt the file to test my code. I know chances are very less but I want to check all the other people if its possible in anyway to do that ? Any dirty way for test simulation would be ok.

I already tried vi ,echo, mv,rm and what my little head can come across but could not do that.

Any way possible ?

scai
  • 2,359
monk
  • 109

1 Answers1

2

You can't modify /proc/partitions directly (or any other file inside /proc). These files are automagically generated by the kernel whenever someone opens them. However, reading from a different (manually) created file should suffice, as already pointed out by others.

Additionally, you shouldn't put the string /proc/partitions "more then 722 times" in your code. This is a really bad design. Instead, either create a global constant for it or keep it only hard-coded at the position where you open it.

scai
  • 2,359