1
1

files: prevent dereferencing a possible (although very unlikely) NULL

Don't catch the NULL earlier, because we do want an error message when
opening the lockfile fails.
Этот коммит содержится в:
Benno Schulenberg 2016-06-04 09:30:41 +02:00
родитель 0293eac1d1
Коммит 9f4b4c975a

Просмотреть файл

@ -252,7 +252,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
snprintf(&lockdata[2], 11, "nano %s", VERSION);
strncpy(&lockdata[28], mypwuid->pw_name, 16);
strncpy(&lockdata[68], myhostname, 31);
strncpy(&lockdata[108], origfilename, 768);
if (origfilename != NULL)
strncpy(&lockdata[108], origfilename, 768);
if (modified == TRUE)
lockdata[1007] = 0x55;