Errata

Linux System Programming

Errata for Linux System Programming

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page page 94-95
writev() example

The following statement produces a warning at the compiler level.
printf ("wrote %d bytes\n", nr);

To fix that, it is advised to change the statement as follows :
printf ("wrote %zd bytes\n", nr);

This below if statement generates an error because of the lack of undeclared function required to use the close system call.
if (close (fd)) {
perror ("close");
return 1;
}

To fix it is advised to declare at the top the unistd header file.
#include <unistd.h>

Best regards.

Boris ASSOGBA  Sep 09, 2023 
Printed Page 24, 28
The bold code snippet

#include <fcntl.h> instead of #include <fcnt1.h>
(I mean l instead of 1)

Anonymous  Jun 17, 2011 
PDF Page 47
3rd and 4th code snippets

"int pos;" should be "off_t pos;"
"int ret;" should be "off_t ret;"

Thus, the type castings "(off_t) -1" in the "if" statements are justified.

Elias Rodrigues  Jun 13, 2017 
PDF Page 52
2nd paragraph i.e. pselect()

The definition for the last argument of pselect, sigset_t *sigmask, is not presented. I suggest an example for pselect() to be included in addition to defining sigmask argument.

Naser Sharifi  Apr 05, 2011 
Printed Page 86
writev() example code

In the following line of code:

fd = open("buccaneer.txt", O_WRONLY | O_CREAT | O_TRUNC);

The O_CREAT flag is specified, but no mode argument is supplied.

In fact, on page 27 of the printed book the first paragraph states:

The mode argument is ignored unless a file is created. it is required if O_CREAT is given. If you forget to provide the mode argument when using O_CREST the results are undefined, and often quite ugly - so don't forget!

The line of code above will not compile under Ubuntu 11.04 (2.6.38-8)

/usr/include/bits/fcntl2.h:51:24: error: call to ?__open_missing_mode? declared with attribute error: open with O_CREAT in second argument needs 3 arguments

Anonymous  Jun 25, 2011 
PDF Page 143
first code snippet

execvp accept its arguments in a vector. It is not a variadic function. This should be changed in execlp

Mirko Banchi  Apr 27, 2016 
Printed Page 143
First Code Example

The first code example says `execvp ("vi", "vi", "/home/kidd/hooks.txt", NULL);` but execvp takes arguments as a vector.

Cody Swaney  Aug 18, 2022