Skip to content

Commit

Permalink
Fix integer overflow issue in the temp rdb file naming. (#702)
Browse files Browse the repository at this point in the history
Co-authored-by: Karthick Ariyaratnam (A) <[email protected]>
  • Loading branch information
karthyuom and Karthick Ariyaratnam (A) authored Sep 29, 2023
1 parent a0f280e commit 5b12251
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3740,7 +3740,7 @@ void syncWithMaster(connection *conn) {
auto dt = std::chrono::system_clock::now().time_since_epoch();
auto dtMillisecond = std::chrono::duration_cast<std::chrono::milliseconds>(dt);
snprintf(tmpfile,sizeof(tmpfile),
"temp-%d.%ld.rdb",(int)dtMillisecond.count(),(long int)getpid());
"temp-%lld.%ld.rdb",(long long)dtMillisecond.count(),(long int)getpid());
dfd = open(tmpfile,O_CREAT|O_WRONLY|O_EXCL,0644);
if (dfd != -1) break;
sleep(1);
Expand Down

0 comments on commit 5b12251

Please sign in to comment.