aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-05-02 12:33:21 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-05-29 15:36:01 +0300
commitd51d421d1b8f1afcedb8593ce835819c57792f45 (patch)
treea60714c04102e431b7bb96b7f4e5c2dc5ab5db76
parentc8f34d79c4f5d6f061d744538949167afa803f5f (diff)
flash_erase: use pwrite() rather than lseek() && write()
Saves a syscall. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r--flash_erase.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/flash_erase.c b/flash_erase.c
index 326a299..1421cf9 100644
--- a/flash_erase.c
+++ b/flash_erase.c
@@ -277,11 +277,7 @@ int main(int argc, char *argv[])
continue;
}
} else {
- if (lseek(fd, offset, SEEK_SET) < 0) {
- sys_errmsg("%s: MTD lseek failure", mtd_device);
- continue;
- }
- if (write(fd, &cleanmarker, sizeof(cleanmarker)) != sizeof(cleanmarker)) {
+ if (pwrite(fd, &cleanmarker, sizeof(cleanmarker), (loff_t)offset) != sizeof(cleanmarker)) {
sys_errmsg("%s: MTD write failure", mtd_device);
continue;
}