~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_write.cc

  • Committer: Monty Taylor
  • Date: 2009-04-25 20:45:19 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1003.
  • Revision ID: mordred@inaugust.com-20090425204519-lgrl7mz2r66v0jby
Blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/error.h"
20
 
#include <cerrno>
21
 
 
22
 
namespace drizzled
23
 
{
24
 
namespace internal
25
 
{
 
16
#include "mysys_priv.h"
 
17
#include "mysys_err.h"
 
18
#include <errno.h>
 
19
 
26
20
 
27
21
        /* Write a chunk of bytes to a file */
28
22
 
46
40
      Buffer+=writenbytes;
47
41
      Count-=writenbytes;
48
42
    }
49
 
    errno=errno;
 
43
    my_errno=errno;
50
44
#ifndef NO_BACKGROUND
51
45
    if (my_thread_var->abort)
52
46
      MyFlags&= ~ MY_WAIT_IF_FULL;              /* End if aborted by user */
53
 
    if ((errno == ENOSPC || errno == EDQUOT) &&
 
47
    if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
54
48
        (MyFlags & MY_WAIT_IF_FULL))
55
49
    {
56
50
      if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
57
51
        my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
58
 
                 "unknown", errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
 
52
                 my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
59
53
      sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
60
54
      continue;
61
55
    }
62
56
 
63
57
    if ((writenbytes == 0 || writenbytes == (size_t) -1))
64
58
    {
65
 
      if (errno == EINTR)
 
59
      if (my_errno == EINTR)
66
60
      {
67
61
        continue;                               /* Interrupted */
68
62
      }
82
76
      if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
83
77
      {
84
78
        my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
85
 
                 "unknown", errno);
 
79
                 my_filename(Filedes),my_errno);
86
80
      }
87
81
      return(MY_FILE_ERROR);            /* Error on read */
88
82
    }
93
87
    return(0);                  /* Want only errors */
94
88
  return(writenbytes+written);
95
89
} /* my_write */
96
 
 
97
 
} /* namespace internal */
98
 
} /* namespace drizzled */