Replace fgetln() with getline() getline() is, per the latter's OpenBSD man page, safer and more portable than fgetln().