/alps/fastwriter

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/fastwriter

« back to all changes in this revision

Viewing changes to default.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-03-26 13:00:45 UTC
  • Revision ID: csa@dside.dyndns.org-20120326130045-nmkwxwcs6q4iecny
Try without O_DIRECT if run under normal user

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
        open_flags |= O_TRUNC;
118
118
 
119
119
    ctx->fd = open(name, open_flags, open_mode);
120
 
    if (ctx->fd < 0) return errno;
 
120
#ifdef SYNC_MODE
 
121
    if (ctx->fd < 0) {
 
122
            // Running as normal user, try to disable direct mode
 
123
        if ((errno == EINVAL)&&(ctx->sync_mode)) {
 
124
            ctx->sync_mode = 0;
 
125
            open_flags &= ~O_DIRECT;
 
126
            ctx->fd = open(name, open_flags, open_mode);
 
127
        }
 
128
#endif /* SYNC_MODE */
 
129
        if (ctx->fd < 0) return errno;
 
130
#ifdef SYNC_MODE
 
131
    }
 
132
#endif /* SYNC_MODE */
121
133
 
122
134
    if (((open_flags&FASTWRITER_FLAGS_OVERWRITE)==0)&&(strcmp(fs, "raw"))) {
123
135
        ctx->prior_size = lseek(ctx->fd, 0, SEEK_END);