- if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */
- goto ERROR; /* Empty or missing line, or read error. */
+ /* Skip the first line. */
+ r = fscanf(fp, "%*[^\n]\n");
+ if (r < 0) {
+ /* Empty line, read error, or EOF. Yes, if routing table
+ * is completely empty, /proc/net/route has no header.
+ */
+ goto ERROR;