Issuing following command replaces my device file: $cp /dev/zero /dev/fb0 Here /dev/fb0 is a device file and I want to clear framebuffer memory, however cp tries to open device file with O_WRONLY|O_CREAT|O_EXCL and fails to open device file. Then it unlinks device file and creates a new file on my file-system. I don't know if this is intentional or not but, IMHO, this behavior is not expected.
That's not surprising, since you use "copy file(s)" command to perform something quite different from copying of files. Help text for this option says: config FEATURE_NON_POSIX_CP bool "Non-POSIX, but safer, copying to special nodes" default y help With this option, "cp file symlink" will delete symlink and create a regular file. This does not conform to POSIX, but prevents a symlink attack. Similarly, "cp file device" will not send file's data to the device. (To do that, use "cat file >device") Thus, either disable FEATURE_NON_POSIX_CP and recompile your busybox, or use cat /dev/zero >/dev/fb0 instead of cp.