This diff would be nicer to read if the link handling would be inserted before the final `else` i.e. if the order was `DT_DIR`, `DT_LNK`, `DT_REG`.