Merge "init: Fix load_firmware error"
am: f330e5462d
* commit 'f330e5462d200080d1694834282afadc018060e1':
init: Fix load_firmware error
This commit is contained in:
commit
de0af89c82
1 changed files with 5 additions and 12 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <android-base/file.h>
|
||||||
#include <cutils/list.h>
|
#include <cutils/list.h>
|
||||||
#include <cutils/uevent.h>
|
#include <cutils/uevent.h>
|
||||||
|
|
||||||
|
|
@ -769,21 +770,13 @@ static int load_firmware(int fw_fd, int loading_fd, int data_fd)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!android::base::WriteFully(data_fd, buf, nr)) {
|
||||||
len_to_copy -= nr;
|
ret = -1;
|
||||||
while (nr > 0) {
|
break;
|
||||||
ssize_t nw = 0;
|
|
||||||
|
|
||||||
nw = write(data_fd, buf + nw, nr);
|
|
||||||
if(nw <= 0) {
|
|
||||||
ret = -1;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
nr -= nw;
|
|
||||||
}
|
}
|
||||||
|
len_to_copy -= nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
if(!ret)
|
if(!ret)
|
||||||
write(loading_fd, "0", 1); /* successful end of transfer */
|
write(loading_fd, "0", 1); /* successful end of transfer */
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue