diff options
author | Nick Clifton <nickc@redhat.com> | 2005-01-04 15:47:38 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2005-01-04 15:47:38 +0000 |
commit | 9f79393915fe207d569b656e9441ed0c18a36844 (patch) | |
tree | 04a2f0c7cec57ad6336eb223bfd0476b92d0c19e /binutils/nlmconv.c | |
parent | 0bfc0f3bfcc71b3b7423a7d16bc4869f4428d8f5 (diff) | |
download | binutils-redhat-9f79393915fe207d569b656e9441ed0c18a36844.tar.gz |
PR binutils/630
* nlmconv.c (main): Only store the basename of the output filename in the
module table.
Diffstat (limited to 'binutils/nlmconv.c')
-rw-r--r-- | binutils/nlmconv.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c index 9b5e4c8ead..1bbd22a887 100644 --- a/binutils/nlmconv.c +++ b/binutils/nlmconv.c @@ -1057,18 +1057,24 @@ main (int argc, char **argv) sharedhdr.exitProcedureOffset; free (data); } - len = strlen (output_file); - if (len > NLM_MODULE_NAME_SIZE - 2) - len = NLM_MODULE_NAME_SIZE - 2; - nlm_fixed_header (outbfd)->moduleName[0] = len; - - strncpy (nlm_fixed_header (outbfd)->moduleName + 1, output_file, - NLM_MODULE_NAME_SIZE - 2); - nlm_fixed_header (outbfd)->moduleName[NLM_MODULE_NAME_SIZE - 1] = '\0'; - for (modname = nlm_fixed_header (outbfd)->moduleName; - *modname != '\0'; - modname++) - *modname = TOUPPER (*modname); + + { + const int max_len = NLM_MODULE_NAME_SIZE - 2; + const char * filename = lbasename (output_file); + + len = strlen (filename); + if (len > max_len) + len = max_len; + nlm_fixed_header (outbfd)->moduleName[0] = len; + + strncpy (nlm_fixed_header (outbfd)->moduleName + 1, filename, max_len); + nlm_fixed_header (outbfd)->moduleName[max_len + 1] = '\0'; + + for (modname = nlm_fixed_header (outbfd)->moduleName; + *modname != '\0'; + modname++) + *modname = TOUPPER (*modname); + } strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG", NLM_OLD_THREAD_NAME_LENGTH); |