~ubuntu-branches/debian/squeeze/nginx/squeeze

« back to all changes in this revision

Viewing changes to src/core/ngx_file.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2009-05-31 18:38:56 UTC
  • mfrom: (1.1.10 upstream) (4.1.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20090531183856-3xhvf6wd0bw5556i
Tags: 0.7.59-1
* New upstream release, first in Debian for the 0.7 branch. Among other
  issues, it also fixes the problem with wildcard dns names used with SSL.
  (Closes: #515904)
* debian/watch: updated.
* debian/postinst: fixed a bashism. (Closes: #507913)
* debian/conf/nginx.conf: removed default_type. (Closes: #509390)
* debian/control: updated Standards-Version to 3.8.1, no changes needed.
* debian/NEWS.Debian: documented the issues with
  server_names_hash_bucket_size. (Closes: #524785)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
    file->name.len = path->name.len + 1 + path->len + 10;
48
48
 
49
 
    file->name.data = ngx_palloc(pool, file->name.len + 1);
 
49
    file->name.data = ngx_pnalloc(pool, file->name.len + 1);
50
50
    if (file->name.data == NULL) {
51
51
        return NGX_ERROR;
52
52
    }
259
259
        path->name.len--;
260
260
    }
261
261
 
262
 
    if (ngx_conf_full_name(cf->cycle, &path->name, 0) == NGX_ERROR) {
 
262
    if (ngx_conf_full_name(cf->cycle, &path->name, 0) != NGX_OK) {
263
263
        return NULL;
264
264
    }
265
265
 
266
266
    path->len = 0;
267
 
    path->cleaner = (ngx_gc_handler_pt) cmd->post;
 
267
    path->manager = (ngx_path_manager_pt) cmd->post;
268
268
    path->conf_file = cf->conf_file->file.name.data;
269
269
    path->line = cf->conf_file->line;
270
270
 
293
293
 
294
294
 
295
295
char *
 
296
ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev,
 
297
    ngx_path_init_t *init)
 
298
{
 
299
    if (*path) {
 
300
        return NGX_CONF_OK;
 
301
    }
 
302
 
 
303
    if (prev) {
 
304
        *path = prev;
 
305
        return NGX_CONF_OK;
 
306
    }
 
307
 
 
308
    *path = ngx_palloc(cf->pool, sizeof(ngx_path_t));
 
309
    if (*path == NULL) {
 
310
        return NGX_CONF_ERROR;
 
311
    }
 
312
 
 
313
    (*path)->name = init->name;
 
314
 
 
315
    if (ngx_conf_full_name(cf->cycle, &(*path)->name, 0) != NGX_OK) {
 
316
        return NGX_CONF_ERROR;
 
317
    }
 
318
 
 
319
    (*path)->level[0] = init->level[0];
 
320
    (*path)->level[1] = init->level[1];
 
321
    (*path)->level[2] = init->level[2];
 
322
 
 
323
    (*path)->len = init->level[0] + (init->level[0] ? 1 : 0)
 
324
                   + init->level[1] + (init->level[1] ? 1 : 0)
 
325
                   + init->level[2] + (init->level[2] ? 1 : 0);
 
326
 
 
327
    (*path)->manager = NULL;
 
328
    (*path)->conf_file = NULL;
 
329
 
 
330
    if (ngx_add_path(cf, path) != NGX_OK) {
 
331
        return NGX_CONF_ERROR;
 
332
    }
 
333
 
 
334
    return NGX_CONF_OK;
 
335
}
 
336
 
 
337
 
 
338
char *
296
339
ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
297
340
{
298
341
    char  *confp = conf;
446
489
        {
447
490
        ngx_file_info_t   fi;
448
491
 
449
 
        if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
 
492
        if (ngx_file_info((const char *) path[i]->name.data, &fi)
 
493
            == NGX_FILE_ERROR)
 
494
        {
450
495
            ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
451
496
                          ngx_file_info_n " \"%s\" failed", path[i]->name.data);
452
497
            return NGX_ERROR;
487
532
 
488
533
#if !(NGX_WIN32)
489
534
 
490
 
    if (ngx_change_file_access(src->data, ext->access) == NGX_FILE_ERROR) {
491
 
        ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
492
 
                      ngx_change_file_access_n " \"%s\" failed", src->data);
493
 
        err = 0;
494
 
        goto failed;
 
535
    if (ext->access) {
 
536
        if (ngx_change_file_access(src->data, ext->access) == NGX_FILE_ERROR) {
 
537
            ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
 
538
                          ngx_change_file_access_n " \"%s\" failed", src->data);
 
539
            err = 0;
 
540
            goto failed;
 
541
        }
495
542
    }
496
543
 
497
544
#endif
517
564
            goto failed;
518
565
        }
519
566
 
520
 
        err = ngx_create_full_path(to->data, ngx_dir_access(ext->access));
 
567
        err = ngx_create_full_path(to->data, ngx_dir_access(ext->path_access));
521
568
 
522
569
        if (err) {
523
570
            ngx_log_error(NGX_LOG_CRIT, ext->log, err,
561
608
        }
562
609
    }
563
610
 
564
 
    if (err) {
 
611
    if (err && ext->log_rename_error) {
565
612
        ngx_log_error(NGX_LOG_CRIT, ext->log, err,
566
613
                      ngx_rename_file_n " \"%s\" to \"%s\" failed",
567
614
                      src->data, to->data);
568
615
    }
569
616
 
 
617
    ext->rename_error = err;
 
618
 
570
619
    return NGX_ERROR;
571
620
}
572
621