Handling more errno macros
We'll continue to handle more errno
macros in our version of touch
in this recipe. In the previous recipe, we managed to provoke an Unknown error
message since we only handled permission denied errors. Here, we'll find out what exactly caused that error and what it is called. We'll then implement another if
statement to handle it. Knowing how to find the correct errno
macros will help you gain a deeper understanding of computing, Linux, system calls, and error handling.
Getting ready
Once again, we'll examine the manual pages to find the information we are looking for. The only things that are needed for this recipe are the manual pages, the GCC compiler, and the Make tool.
How to do it…
Follow these steps to complete this recipe:
- Start by reading the manual page for
creat()
by usingman 2 creat
. Scroll down to the ERRORS heading. Read through the descriptions of the different macros. Eventually, you'll...