sstrip: Was missing include of <byteswap.h>
[openwrt/staging/yousong.git] / tools / sstrip / src / sstrip.c
index 6607d12500547787e4eacc230b1be4db2dfd823d..9d5500dd31bb1246678c7341760585f7b66e348a 100644 (file)
@@ -59,6 +59,7 @@
 #include       <unistd.h>
 #include       <fcntl.h>
 #include       <elf.h>
+#include       <byteswap.h>
 
 #ifndef TRUE
 #define        TRUE            1
@@ -251,8 +252,7 @@ static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \
                        ESET(phdr->p_offset,newsize); \
                        ESET(phdr->p_filesz,0); \
                } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \
-                       newsize -= EGET(phdr->p_offset); \
-                       ESET(phdr->p_filesz, newsize); \
+                       ESET(phdr->p_filesz, newsize - EGET(phdr->p_offset)); \
                } \
        } \
  \