Posted inExperience / Information Technology / Thank You Sir May I Have Another

Checking return values

Yes, I had to post one more, hopefully shorter, rant on logger.c. This has to do with “checking return values” in OpenSource code.

# define MSG_NOSIGNAL 0

 if (sendmsg(ctl->fd, &message, MSG_NOSIGNAL) < 0) {
     if (sendmsg(ctl->fd, &message, MSG_NOSIGNAL) < 0)
         warn(_("send message failed"));

Code like this is rampant in OpenSource. It passes the quick and dirty teen age “code review” 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.

The above code is NOT checking the return value in a production quality manner. It isn’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.

Error: 12345 in blah - Severe indigestion

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 “checking the return value” 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.

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’t checked in a production quality manner.


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.