Use errno correctly.

After a failed write() or ioctl(), errno wasn't being checked until
after some other function calls that could also modify errno, thus
checking the wrong errno. Make sure to check it prior to doing anything
else that can modify it.

[Preconditions]
1.PC connects with phone(mtp).

[Procedures]
1.Copy a file from PC to phone.
2.Cancel the copying.
3.Recopy the file.

Change-Id: Id772fca7ccb96d3f43bd4beb210bedd8d3ac17fa
1 file changed