aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/elflink/ldlinux/ldlinux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 82d2ae6d..62db2f71 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -121,12 +121,15 @@ const char *apply_extension(const char *kernel, const char *ext)
memcpy(k, kernel, len);
/* Append the extension */
- memcpy(k + len, ext, elen);
+ if (strncmp(p - elen, ext, elen)) {
+ memcpy(k + len, ext, elen);
+ len += elen;
+ }
/* Copy the rest of the command line */
- strcpy(k + len + elen, p);
+ strcpy(k + len, p);
- k[len + elen + strlen(p)] = '\0';
+ k[len + strlen(p)] = '\0';
return k;
}