From 1c37ef4158637d3570ea3da30eed3dbab1143b82 Mon Sep 17 00:00:00 2001 From: Saggi Mizrahi Date: Sat, 12 Jan 2013 18:54:03 -0500 Subject: [PATCH] Replace pread() in lseek()+read() Signed-off-by: Saggi Mizrahi --- tools/retrolaunch/cd_detect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/retrolaunch/cd_detect.c b/tools/retrolaunch/cd_detect.c index 4e21971647..102d1512d4 100644 --- a/tools/retrolaunch/cd_detect.c +++ b/tools/retrolaunch/cd_detect.c @@ -129,7 +129,8 @@ static int detect_ps1_game(const char* track_path, int32_t offset, return -errno; } - if (pread(fd, buff, 10, 0x9340) > 0) { + lseek(fd, 0x9340, SEEK_SET); + if (read(fd, buff, 10) > 0) { buff[10] = '\0'; buff[4] = '-'; LOG_DEBUG("Found disk label '%s'", buff); @@ -200,7 +201,8 @@ static int detect_system(const char* track_path, int32_t offset, goto clean; } - if (pread(fd, magic, MAGIC_LEN, offset) < MAGIC_LEN) { + lseek(fd, offset, SEEK_SET); + if (read(fd, magic, MAGIC_LEN) < MAGIC_LEN) { LOG_WARN("Could not read data from file '%s' at offset %d: %s", track_path, offset, strerror(errno)); rv = -errno;