~akopytov/percona-xtrabackup/bug1210266-2.1

« back to all changes in this revision

Viewing changes to src/xtrabackup.cc

  • Committer: Alexey Kopytov
  • Date: 2013-08-12 11:42:38 UTC
  • mfrom: (391.144.11 2.0)
  • Revision ID: akopytov@gmail.com-20130812114238-frw3nanyd47pcwpf
Manual merge from 2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2714
2714
/*================*/
2715
2715
        const char*     path)   /*!<in: path to the sync file */
2716
2716
{
2717
 
        ibool                   success;
2718
 
        os_file_t               suspend_file = XB_FILE_UNDEFINED;
2719
 
        pid_t                   pid;
2720
 
        char                    buffer[64];
 
2717
        File    suspend_file;
 
2718
        pid_t   pid;
 
2719
        char    buffer[64];
2721
2720
 
2722
2721
        pid = getpid();
2723
 
        sprintf(buffer, "%d", pid);
2724
 
 
2725
 
        msg("xtrabackup: Creating suspend file '%s' with pid '%u'\n", path, pid);
2726
 
        
2727
 
        suspend_file = xb_file_create_no_error_handling(path, OS_FILE_CREATE,
2728
 
                                                        OS_FILE_READ_WRITE,
2729
 
                                                        &success);
2730
 
        if (UNIV_LIKELY(success && suspend_file != XB_FILE_UNDEFINED)) {
2731
 
                xb_os_file_write(path, suspend_file, buffer, 0, strlen(buffer));
2732
 
                os_file_close(suspend_file);
2733
 
                return(TRUE);
 
2722
        snprintf(buffer, sizeof(buffer), "%u", (uint) pid);
 
2723
 
 
2724
        msg("xtrabackup: Creating suspend file '%s' with pid '%u'\n",
 
2725
            path, (uint) pid);
 
2726
 
 
2727
        suspend_file = my_create(path, 0, O_WRONLY | O_EXCL | O_NOFOLLOW,
 
2728
                                 MYF(MY_WME));
 
2729
 
 
2730
        if (suspend_file >= 0) {
 
2731
                ibool rc;
 
2732
 
 
2733
                rc = my_write(suspend_file, (uchar *) buffer, strlen(buffer),
 
2734
                              MYF(MY_WME | MY_NABP)) == 0;
 
2735
 
 
2736
                my_close(suspend_file, MYF(MY_WME));
 
2737
                return(rc);
2734
2738
        }
2735
2739
 
2736
 
        msg("xtrabackup: Error: failed to create file '%s' with %d\n", path,
2737
 
            os_file_get_last_error(TRUE));
2738
 
 
 
2740
        msg("xtrabackup: Error: failed to create file '%s'\n",
 
2741
            path);
2739
2742
        return(FALSE);
2740
2743
}
2741
2744