Leaked memory.  You should free(filenamelog) once open() has returned (and *before* you check fd and maybe return).