Merge request https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58 was reviewed by Christian Mauderer
-- Christian Mauderer started a new discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121190 > + FILE *file = fopen(filename, "r"); > + if (!file) { > + fprintf(stderr, "error: could not open license file: %s\n", filename); Usually I would suggest to use `perror` for these or add the type or the error with `strerror`: * https://pubs.opengroup.org/onlinepubs/9699919799/functions/perror.html * https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html That provides some more information why opening the file didn't work. -- Christian Mauderer started a new discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121191 > + } > + > + fread(buffer, 1, length, file); `fread` can fail. Please check the return value. In theory the same is true for the two `fseek` calls above. For example: What happens if I use a file on a network file system? -- Christian Mauderer started a new discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121192 > + license_header = read_license_file(licensefile); > + } else if (usebsdlicense) { > + license_header = strdup( I assume you do the `strdup` so you don't have a problem with the `free(license_header)` later? Otherwise you could just use a pointer to a constant string. -- Christian Mauderer started a new discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121193 > stderr, > - "usage: bin2c [-csvzCH] [-N name] [-A alignment] <input_file> > <output_file>\n" > + "usage: bin2c [-csvzCHlB] [-N name] [-A alignment] <input_file> > <output_file>\n" Shouldn't that be a `[-l license_file]`? -- Christian Mauderer started a new discussion on misc/bin2c/rtems-bin2c.c: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58#note_121194 > " -A - add alignment - parameter can be a hexadecimal or decimal > number\n" > + " -l - <license_file> - add the specified file as a license header\n" > + " -B - add a default BSD-2-Clause license header, can't be combined > with -l\n" The way you implemented it, you can combine it. But the `-l` takes precedence. -- View it on GitLab: https://gitlab.rtems.org/rtems/tools/rtems-tools/-/merge_requests/58 You're receiving this email because of your account on gitlab.rtems.org.
_______________________________________________ bugs mailing list bugs@rtems.org http://lists.rtems.org/mailman/listinfo/bugs