Commits

Roger Light committed 39c739b

Don't clobber backup files when writing tmp file.

Use .tmp as suffix for temporary password file name instead of ~ so that user
backups aren't removed.

  • Participants
  • Parent commits 5d2e3ef
  • Branches 1.1.3

Comments (0)

Files changed (1)

src/mosquitto_passwd.c

 			return 1;
 		}
 
-		backup_file = malloc(strlen(password_file)+2);
-		snprintf(backup_file, strlen(password_file)+2, "%s~", password_file);
+		backup_file = malloc(strlen(password_file)+5);
+		snprintf(backup_file, strlen(password_file)+5, "%s.tmp", password_file);
 
 		if(create_backup(backup_file, fptr)){
 			fclose(fptr);