Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167709322
D4238.id10389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D4238.id10389.diff
View Options
Index: elfcopy/binary.c
===================================================================
--- elfcopy/binary.c
+++ elfcopy/binary.c
@@ -37,6 +37,16 @@
ELFTC_VCSID("$Id$");
+static int
+basename_length(const char *filename)
+{
+ char *p;
+
+ if ((p = strchr(filename, '.')) != NULL)
+ return (p - filename);
+ return (strlen(filename));
+}
+
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
* are copied to the result binary. The relative offsets for each section
@@ -139,6 +149,7 @@
GElf_Ehdr oeh;
GElf_Shdr sh;
void *content;
+ int namelen;
uint64_t off, data_start, data_end, data_size;
/* Reset internal section list. */
@@ -210,8 +221,9 @@
/* Count in .symtab and .strtab section headers. */
shtab->sz += gelf_fsize(ecp->eout, ELF_T_SHDR, 2, EV_CURRENT);
+ namelen = basename_length(ifn);
#define _GEN_SYMNAME(S) do { \
- snprintf(name, sizeof(name), "%s%s%s", "_binary_", ifn, S); \
+ snprintf(name, sizeof(name), "%s%.*s%s", "_binary_", namelen, ifn, S);\
} while (0)
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 24, 9:46 PM (16 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37211124
Default Alt Text
D4238.id10389.diff (1 KB)
Attached To
Mode
D4238: elfcopy: exclude extension when converting from binary
Attached
Detach File
Event Timeline
Log In to Comment