[rtems commit] rtems: Make rtems_version_control_key() safer

Sebastian Huber sebh at rtems.org
Mon Sep 9 05:05:55 UTC 2019


Module:    rtems
Branch:    master
Commit:    eaa415b2c7e3105a055d56d8ef4b0f2fccb44d59
Changeset: http://git.rtems.org/rtems/commit/?id=eaa415b2c7e3105a055d56d8ef4b0f2fccb44d59

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep  6 14:31:32 2019 +0200

rtems: Make rtems_version_control_key() safer

Return the empty string instead of a NULL pointer if no version key is
available.

---

 cpukit/include/rtems/version.h | 9 ++++++---
 cpukit/sapi/src/version.c      | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/cpukit/include/rtems/version.h b/cpukit/include/rtems/version.h
index d8c1206..30dd70c 100644
--- a/cpukit/include/rtems/version.h
+++ b/cpukit/include/rtems/version.h
@@ -60,10 +60,13 @@ int rtems_version_revision( void );
 
 /**
  * @brief Returns the version control key for the current version of code that
- * has been built. The key is specific to the version control system being used
- * and allows the built version to be identified.
+ * has been built.
  *
- * @retval int The version's version control key.
+ * The key is specific to the version control system being used and allows the
+ * built version to be identified.
+ *
+ * @return The version control key or the empty string if no version control
+ * key is available.
  */
 const char *rtems_version_control_key( void );
 
diff --git a/cpukit/sapi/src/version.c b/cpukit/sapi/src/version.c
index e1e7705..065a45c 100644
--- a/cpukit/sapi/src/version.c
+++ b/cpukit/sapi/src/version.c
@@ -58,6 +58,6 @@ const char *rtems_version_control_key( void )
 #ifdef RTEMS_VERSION_VC_KEY
   return RTEMS_VERSION_VC_KEY;
 #else
-  return NULL;
+  return "";
 #endif
 }




More information about the vc mailing list