{"id":2727,"date":"2018-02-23T06:05:04","date_gmt":"2018-02-23T12:05:04","guid":{"rendered":"http:\/\/www.logikalsolutions.com\/wordpress\/?p=2727"},"modified":"2018-02-23T05:55:35","modified_gmt":"2018-02-23T11:55:35","slug":"checking-return-values","status":"publish","type":"post","link":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/","title":{"rendered":"Checking return values"},"content":{"rendered":"<p>Yes, I had to post one more, hopefully shorter, rant on logger.c. This has to do with &#8220;checking return values&#8221; in OpenSource code.<\/p>\n<pre>#ifndef MSG_NOSIGNAL\r\n# define MSG_NOSIGNAL 0\r\n#endif\r\n\r\n if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) {\r\n     logger_reopen(ctl);\r\n     if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0)\r\n         warn(_(\"send message failed\"));\r\n }\r\n<\/pre>\n<p>Code like this is rampant in OpenSource. It passes the quick and dirty teen age &#8220;code review&#8221; but it is not production quality. If Linux and the OpenSource community wants to gain respect it needs to start writing production quality code. This means real QA not automated tests run via Jenkins which test nothing.<\/p>\n<p>The above code is NOT checking the return value in a production quality manner. It isn&#8217;t catching the error and reporting it via some human readable log entry. Ideally it should catch the error and report it along with the human readable text associated with the error.<\/p>\n<pre>Error: 12345 in blah - Severe indigestion<\/pre>\n<p>The hapless schmoe who has to debug this has to modify the code before they can even gain access to the error in the debugger. This code adheres to the letter of &#8220;checking the return value&#8221; without adhering to the spirit of it in a production quality manner. Snippets like this make it nigh on impossible to port OpenSource code to a regular production platform.<\/p>\n<p>Scarier still are the publicly traded corporations running production systems on operating systems containing this type of code. Then they wonder how they got hacked without knowing it. Well, quite simply, because error return values weren&#8217;t checked in a production quality manner.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, I had to post one more, hopefully shorter, rant on logger.c. This has to do with &#8220;checking return values&#8221; in OpenSource code. #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) { logger_reopen(ctl); if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) warn(_(&#8220;send message failed&#8221;)); } Code like this is rampant in OpenSource. It passes the quick and dirty teen age &#8220;code review&#8221; but it is not production quality. If Linux and the &hellip; <a title=\"Checking return values\" class=\"bnm-read-more\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/\"><span class=\"screen-reader-text\">Checking return values<\/span>Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1309,3,4],"tags":[53,1586,1587,689],"class_list":["post-2727","post","type-post","status-publish","format-standard","hentry","category-experience","category-information-technology","category-thank-you-sir-may-i-have-another","tag-linux","tag-logger","tag-logger-c","tag-opensource","bnm-entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Checking return values &#8211; Logikal Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Checking return values &#8211; Logikal Blog\" \/>\n<meta property=\"og:description\" content=\"Yes, I had to post one more, hopefully shorter, rant on logger.c. This has to do with &#8220;checking return values&#8221; in OpenSource code. #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) { logger_reopen(ctl); if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) warn(_(&quot;send message failed&quot;)); } Code like this is rampant in OpenSource. It passes the quick and dirty teen age &#8220;code review&#8221; but it is not production quality. If Linux and the &hellip; Checking return valuesRead more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/\" \/>\n<meta property=\"og:site_name\" content=\"Logikal Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-23T12:05:04+00:00\" \/>\n<meta name=\"author\" content=\"seasoned_geek\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"seasoned_geek\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/\"},\"author\":{\"name\":\"seasoned_geek\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"headline\":\"Checking return values\",\"datePublished\":\"2018-02-23T12:05:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/\"},\"wordCount\":238,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"keywords\":[\"Linux\",\"logger\",\"logger.c\",\"opensource\"],\"articleSection\":[\"Experience\",\"Information Technology\",\"Thank You Sir May I Have Another\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/\",\"name\":\"Checking return values &#8211; Logikal Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\"},\"datePublished\":\"2018-02-23T12:05:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/information-technology\\\/checking-return-values\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Checking return values\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/\",\"name\":\"Logikal Blog\",\"description\":\"For people with attention spans longer than a Tweet\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/c077f770ade13de7faaf616c3eac6842\",\"name\":\"seasoned_geek\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\",\"caption\":\"seasoned_geek\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r\"},\"description\":\"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\\\/Qt touchscreen\\\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \\\"Zinc It!\\\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \\\"The Minimum You Need to Know to Be an OpenVMS Application Developer\\\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \\\"The Minimum You Need to Know\\\" book series was born. Three years later he wrote his first novel \\\"Infinite Exposure\\\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \\\"The Earth That Was\\\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.\",\"sameAs\":[\"https:\\\/\\\/theminimumyouneedtoknow.com\"],\"url\":\"https:\\\/\\\/www.logikalsolutions.com\\\/wordpress\\\/author\\\/seasoned_geek\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Checking return values &#8211; Logikal Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/","og_locale":"en_US","og_type":"article","og_title":"Checking return values &#8211; Logikal Blog","og_description":"Yes, I had to post one more, hopefully shorter, rant on logger.c. This has to do with &#8220;checking return values&#8221; in OpenSource code. #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) { logger_reopen(ctl); if (sendmsg(ctl-&gt;fd, &amp;message, MSG_NOSIGNAL) &lt; 0) warn(_(\"send message failed\")); } Code like this is rampant in OpenSource. It passes the quick and dirty teen age &#8220;code review&#8221; but it is not production quality. If Linux and the &hellip; Checking return valuesRead more","og_url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/","og_site_name":"Logikal Blog","article_published_time":"2018-02-23T12:05:04+00:00","author":"seasoned_geek","twitter_card":"summary_large_image","twitter_misc":{"Written by":"seasoned_geek","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/#article","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/"},"author":{"name":"seasoned_geek","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"headline":"Checking return values","datePublished":"2018-02-23T12:05:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/"},"wordCount":238,"commentCount":0,"publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"keywords":["Linux","logger","logger.c","opensource"],"articleSection":["Experience","Information Technology","Thank You Sir May I Have Another"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/","url":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/","name":"Checking return values &#8211; Logikal Blog","isPartOf":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website"},"datePublished":"2018-02-23T12:05:04+00:00","breadcrumb":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/information-technology\/checking-return-values\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.logikalsolutions.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Checking return values"}]},{"@type":"WebSite","@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#website","url":"https:\/\/www.logikalsolutions.com\/wordpress\/","name":"Logikal Blog","description":"For people with attention spans longer than a Tweet","publisher":{"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.logikalsolutions.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.logikalsolutions.com\/wordpress\/#\/schema\/person\/c077f770ade13de7faaf616c3eac6842","name":"seasoned_geek","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","url":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r","caption":"seasoned_geek"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/ae9adac14079d84b909e635d7af986fe4568053af4fd9ff8d4109298c392493e?s=96&d=mm&r=r"},"description":"Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++\/Qt touchscreen\/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the \"Zinc It!\" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome \"The Minimum You Need to Know to Be an OpenVMS Application Developer\" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there \"The Minimum You Need to Know\" book series was born. Three years later he wrote his first novel \"Infinite Exposure\" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of \"The Earth That Was\" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.","sameAs":["https:\/\/theminimumyouneedtoknow.com"],"url":"https:\/\/www.logikalsolutions.com\/wordpress\/author\/seasoned_geek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/2727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2727"}],"version-history":[{"count":0,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/posts\/2727\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.logikalsolutions.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}