[Lsb-messages] /var/www/bzr/lsb/devel/build_env r2323: quiet a couple of coverity reports

Mats Wichmann mats at linuxfoundation.org
Mon Dec 5 16:34:44 UTC 2016


------------------------------------------------------------
revno: 2323
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: build_env
timestamp: Mon 2016-12-05 09:34:44 -0700
message:
  quiet a couple of coverity reports
modified:
  lsbdev-cc/lsbcc.c
  lsbdev-cc/lsbcpp.c
  lsbdev-runner/lsbrun.c
  package/Makefile
-------------- next part --------------
=== modified file 'lsbdev-cc/lsbcc.c'
--- a/lsbdev-cc/lsbcc.c	2016-11-18 16:21:12 +0000
+++ b/lsbdev-cc/lsbcc.c	2016-12-05 16:34:44 +0000
@@ -1395,7 +1395,7 @@
 	    found_gcc_arg = 1;
 	    if (lsbcc_debug & DEBUG_RECOGNIZED_ARGS) {
 		fprintf(stderr, "option0: -%s",long_options[option_index].name);
-		if (optarg) {
+		if (long_options[option_index].has_arg) {
 		    fprintf(stderr, " with arg %s", optarg);
 		}
 		fprintf(stderr, "\n");

=== modified file 'lsbdev-cc/lsbcpp.c'
--- a/lsbdev-cc/lsbcpp.c	2016-11-18 16:19:43 +0000
+++ b/lsbdev-cc/lsbcpp.c	2016-12-05 16:34:44 +0000
@@ -299,7 +299,7 @@
 	    if (lsbcc_debug & DEBUG_RECOGNIZED_ARGS) {
 		fprintf(stderr, "option0: -%s",
 			long_options[option_index].name);
-		if (optarg) {
+		if (long_options[option_index].has_arg) {
 		    fprintf(stderr, " with arg %s", optarg);
 		}
 		fprintf(stderr, "\n");

=== modified file 'lsbdev-runner/lsbrun.c'
--- a/lsbdev-runner/lsbrun.c	2015-03-30 15:13:41 +0000
+++ b/lsbdev-runner/lsbrun.c	2016-12-05 16:34:44 +0000
@@ -170,9 +170,8 @@
     /* Make sure the lsbrun copy has the same permissions as the old
        binary. */
 
-    if (stat(new_binary_path, &binary_stat) == 0) {
-      chmod(binary_path, binary_stat.st_mode & 07777);
-    } else {
+    if (! (stat(new_binary_path, &binary_stat) == 0 &&
+           chmod(binary_path, binary_stat.st_mode & 07777) == 0)) {
       perror("lsbrun");
       fprintf(stderr, 
 	      "warning: check the target binary, it may not be executable\n");
@@ -212,7 +211,7 @@
 
   /* First, let's figure out how we were started. */
 
-  strcpy(buf, argv[0]);
+  strncpy(buf, argv[0], PATH_MAX);
   if (strstr(basename(buf), "lsbrun") != NULL) {
     if ((argc < 2) || (strcmp(argv[1], "--help") == 0)) {
 

=== modified file 'package/Makefile'
--- a/package/Makefile	2016-11-18 16:21:12 +0000
+++ b/package/Makefile	2016-12-05 16:34:44 +0000
@@ -50,7 +50,7 @@
 # Should have leading "."
 # a big number (80-99) is leading up to the next minor spec
 # build_env is version-independent so can wait till late to bump this
-SUB_VERSION=.8
+SUB_VERSION=.9
 
 # We define this here instead of directly in the spec file as
 # we need to be able to work out what the produced rpm files will be called



More information about the lsb-messages mailing list