dtlogin: coverity fixes

This commit is contained in:
Peter Howkins
2018-04-13 00:54:04 +01:00
parent 4e9dc6c50b
commit 13d3e1db50
14 changed files with 52 additions and 60 deletions

View File

@@ -874,7 +874,7 @@ StartDisplay(
bkup[0] = '\0';
if (d->authFile)
strcpy(bkup ,d->authFile);
snprintf(bkup, sizeof(bkup), "%s", d->authFile);
LoadDisplayResources (d);
@@ -1340,7 +1340,9 @@ StorePid( void )
* open it Read/Write. This will be transparent to HP-UX.
*/
pidFd = creat (pidFile, 0644);
close( pidFd );
if(pidFd != -1) {
close( pidFd );
}
pidFd = open (pidFile, 2);
}
if (pidFd == -1 || !(pidFilePtr = fdopen (pidFd, "r+")))
@@ -1623,8 +1625,7 @@ GettyMessage( struct display *d, int msgnum )
if (quiet) return;
strcpy(buf,"/dev/");
strcat(buf,d->gettyLine);
snprintf(buf, sizeof(buf), "/dev/%s", d->gettyLine);
if ( (tf = fopen (buf, "a")) != NULL) {
fprintf (tf,