OSDN Git Service

Fix a TEMP_FAILURE_RETRY usage error in the linker.
authorElliott Hughes <enh@google.com>
Fri, 27 Jul 2012 22:30:51 +0000 (15:30 -0700)
committerElliott Hughes <enh@google.com>
Fri, 27 Jul 2012 22:30:51 +0000 (15:30 -0700)
Similar to the fix in c20d0f3993ebb0d3dec958a306a68ebb48bfeadd.

grep(1) says this was the only other instance in bionic.

Change-Id: I1729038762ee1c7c4743a6bd11d5558afd6f5749

linker/linker.c

index b96e072..0a93130 100644 (file)
@@ -648,16 +648,15 @@ typedef struct {
 static unsigned long
 is_prelinked(int fd, const char *name)
 {
-    off_t sz;
-    prelink_info_t info;
-
-    sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END);
+    off_t sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END);
     if (sz < 0) {
         DL_ERR("lseek() failed!");
         return 0;
     }
 
-    if (TEMP_FAILURE_RETRY(read(fd, &info, sizeof(info)) != sizeof(info))) {
+    prelink_info_t info;
+    int rc = TEMP_FAILURE_RETRY(read(fd, &info, sizeof(info)));
+    if (rc != sizeof(info)) {
         WARN("Could not read prelink_info_t structure for `%s`\n", name);
         return 0;
     }