2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>

* rtems-bin2c.c: Fix memory leak in '.c' suffix strip.
	Also strip '.h' suffix.
This commit is contained in:
Ralf Corsepius
2010-07-30 12:44:32 +00:00
parent b3ef132204
commit 49fb1c5033
2 changed files with 11 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* rtems-bin2c.c: Fix memory leak in '.c' suffix strip.
Also strip '.h' suffix.
2010-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* rtems-bin2c.c: Make -v (verbose) working.

View File

@@ -70,8 +70,12 @@ void process(const char *ifname, const char *ofname)
strncpy( obasename, ofname, PATH_MAX );
len = strlen( obasename );
if ( obasename[len-2] == '.' && obasename[len-1] == 'c' )
obasename[len-2] = '\0';
if ( len >= 2 ) {
if ( obasename[len-2] == '.' ) {
if ( (obasename[len-1] == 'c') || (obasename[len-1] == 'h') )
obasename[len-2] = '\0';
}
}
sprintf( ocname, "%s.c", obasename );
sprintf( ohname, "%s.h", obasename );