Changeset 896
- Timestamp:
- Mar 21, 2016, 2:30:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/tdb/common/open.c
r895 r896 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 … … 120 120 } 121 121 122 /* open the database, creating it if necessary 122 /* open the database, creating it if necessary 123 123 124 124 The open_flags and mode are passed straight to the open call on the … … 126 126 is advisory, use zero for a default value. 127 127 128 Return is NULL on error, in which case errno is also set. Don't 128 Return is NULL on error, in which case errno is also set. Don't 129 129 try to call tdb_error or tdb_errname, just do strerror(errno). 130 130 … … 172 172 char lock_name[_MAX_PATH + 5]; 173 173 snprintf(lock_name, sizeof(lock_name), "%s.lock", name); 174 /* 175 * First try to O_TRUNC it to make sure the file is empty (this 176 * will succeed on first open), but ignore the error that will 177 * happen if some bytes are already locked. 178 */ 174 179 tdb->lock_fd = open(lock_name, tdb->open_flags | O_CREAT | O_TRUNC, 0777); 180 if (tdb->lock_fd == -1 && errno == EACCES) 181 tdb->lock_fd = open(lock_name, tdb->open_flags | O_CREAT, 0777); 175 182 if (tdb->lock_fd == -1) { 176 183 TDB_LOG((tdb, TDB_DEBUG_ERROR, "os2_create_lockfile: cannot create lock file %s, errno=%d\n",
Note:
See TracChangeset
for help on using the changeset viewer.