~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_write.cc

  • Committer: Brian Aker
  • Date: 2009-03-05 07:54:39 UTC
  • mto: This revision was merged to the branch mainline in revision 911.
  • Revision ID: brian@tangent.org-20090305075439-ubkvoauwj5er551l
Remove some dead bits of string (and fix the semi_join test).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
 
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/internal/thread_var.h"
20
 
#include "drizzled/error.h"
21
 
#include <cerrno>
22
 
 
23
 
namespace drizzled
24
 
{
25
 
namespace internal
26
 
{
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#include "mysys_priv.h"
 
17
#include "mysys_err.h"
 
18
#include <errno.h>
 
19
 
27
20
 
28
21
        /* Write a chunk of bytes to a file */
29
22
 
47
40
      Buffer+=writenbytes;
48
41
      Count-=writenbytes;
49
42
    }
50
 
    errno=errno;
 
43
    my_errno=errno;
 
44
#ifndef NO_BACKGROUND
 
45
    if (my_thread_var->abort)
 
46
      MyFlags&= ~ MY_WAIT_IF_FULL;              /* End if aborted by user */
 
47
    if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
 
48
        (MyFlags & MY_WAIT_IF_FULL))
 
49
    {
 
50
      if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
 
51
        my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
 
52
                 my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
 
53
      sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
 
54
      continue;
 
55
    }
 
56
 
 
57
    if ((writenbytes == 0 || writenbytes == (size_t) -1))
 
58
    {
 
59
      if (my_errno == EINTR)
 
60
      {
 
61
        continue;                               /* Interrupted */
 
62
      }
 
63
 
 
64
      if (!writenbytes && !errors++)            /* Retry once */
 
65
      {
 
66
        /* We may come here if the file quota is exeeded */
 
67
        errno=EFBIG;                            /* Assume this is the error */
 
68
        continue;
 
69
      }
 
70
    }
 
71
    else
 
72
      continue;                                 /* Retry */
 
73
#endif
51
74
    if (MyFlags & (MY_NABP | MY_FNABP))
52
75
    {
53
76
      if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
54
77
      {
55
78
        my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
56
 
                 "unknown", errno);
 
79
                 my_filename(Filedes),my_errno);
57
80
      }
58
81
      return(MY_FILE_ERROR);            /* Error on read */
59
82
    }
64
87
    return(0);                  /* Want only errors */
65
88
  return(writenbytes+written);
66
89
} /* my_write */
67
 
 
68
 
} /* namespace internal */
69
 
} /* namespace drizzled */