Changeset 7e10f7cd6a31e714c883c3b0f528f09b004a2d9f

Show
Ignore:
Timestamp:
11/16/11 06:24:08 (2 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1321424648 -0500
git-parent:

[d3ed2ae82b2d3ed70d28abd1aa952fb2fe0b9c56]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1321424648 -0500
Message:

There is a race condition if we crash between the link and the next run.
The link will be in place and we'll get an error on link() with EEXIST.
I believe this is "okay" to continue.

We still need a test as the other code path link() with errno != EEXIST
will still explode.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/handoff_ingestor.c

    r9799031 r7e10f7c  
    183183  if(strcmp(path + strlen(path) - 2, ".h")) { 
    184184    snprintf(hfile, sizeof(hfile), "%s.h", path); 
    185     if(link(path, hfile) < 0) { 
    186       noitL(noit_error, "cannot link journal: %s\n", strerror(errno)); 
     185    if(link(path, hfile) < 0 && errno != EEXIST) { 
     186      noitL(noit_error, "cannot link journal %s: %s\n", path, strerror(errno)); 
    187187      return -1; 
    188188    } 
  • src/modules/postgres_ingestor.c

    r9799031 r7e10f7c  
    14241424  if(strcmp(path + strlen(path) - 3, ".pg")) { 
    14251425    snprintf(pgfile, sizeof(pgfile), "%s.pg", path); 
    1426     if(link(path, pgfile) < 0) { 
    1427       noitL(noit_error, "cannot link journal: %s\n", strerror(errno)); 
     1426    if(link(path, pgfile) < 0 && errno != EEXIST) { 
     1427      noitL(noit_error, "cannot link journal %s: %s\n", path, strerror(errno)); 
    14281428      free(ij); 
    14291429      return -1;