@@ -816,9 +816,8 @@ static void start_packfile(void)
816816 struct pack_header hdr ;
817817 int pack_fd ;
818818
819- snprintf (tmpfile , sizeof (tmpfile ),
820- "%s/pack/tmp_pack_XXXXXX" , get_object_directory ());
821- pack_fd = xmkstemp (tmpfile );
819+ pack_fd = odb_mkstemp (tmpfile , sizeof (tmpfile ),
820+ "pack/tmp_pack_XXXXXX" );
822821 p = xcalloc (1 , sizeof (* p ) + strlen (tmpfile ) + 2 );
823822 strcpy (p -> pack_name , tmpfile );
824823 p -> pack_fd = pack_fd ;
@@ -878,9 +877,8 @@ static char *create_index(void)
878877 c = next ;
879878 }
880879
881- snprintf (tmpfile , sizeof (tmpfile ),
882- "%s/pack/tmp_idx_XXXXXX" , get_object_directory ());
883- idx_fd = xmkstemp (tmpfile );
880+ idx_fd = odb_mkstemp (tmpfile , sizeof (tmpfile ),
881+ "pack/tmp_idx_XXXXXX" );
884882 f = sha1fd (idx_fd , tmpfile );
885883 sha1write (f , array , 256 * sizeof (int ));
886884 git_SHA1_Init (& ctx );
@@ -906,9 +904,7 @@ static char *keep_pack(char *curr_index_name)
906904 chmod (pack_data -> pack_name , 0444 );
907905 chmod (curr_index_name , 0444 );
908906
909- snprintf (name , sizeof (name ), "%s/pack/pack-%s.keep" ,
910- get_object_directory (), sha1_to_hex (pack_data -> sha1 ));
911- keep_fd = open (name , O_RDWR |O_CREAT |O_EXCL , 0600 );
907+ keep_fd = odb_pack_keep (name , sizeof (name ), pack_data -> sha1 );
912908 if (keep_fd < 0 )
913909 die ("cannot create keep file" );
914910 write_or_die (keep_fd , keep_msg , strlen (keep_msg ));
0 commit comments