"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "extstore.c" between
memcached-1.6.8.tar.gz and memcached-1.6.9.tar.gz

About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

extstore.c  (memcached-1.6.8):extstore.c  (memcached-1.6.9)
skipping to change at line 256 skipping to change at line 256
store_engine *e = calloc(1, sizeof(store_engine)); store_engine *e = calloc(1, sizeof(store_engine));
if (e == NULL) { if (e == NULL) {
*res = EXTSTORE_INIT_OOM; *res = EXTSTORE_INIT_OOM;
return NULL; return NULL;
} }
e->page_size = cf->page_size; e->page_size = cf->page_size;
uint64_t temp_page_count = 0; uint64_t temp_page_count = 0;
for (f = fh; f != NULL; f = f->next) { for (f = fh; f != NULL; f = f->next) {
f->fd = open(f->file, O_RDWR | O_CREAT | O_TRUNC, 0644); f->fd = open(f->file, O_RDWR | O_CREAT, 0644);
if (f->fd < 0) { if (f->fd < 0) {
*res = EXTSTORE_INIT_OPEN_FAIL; *res = EXTSTORE_INIT_OPEN_FAIL;
#ifdef EXTSTORE_DEBUG #ifdef EXTSTORE_DEBUG
perror("open"); perror("extstore open");
#endif #endif
free(e); free(e);
return NULL; return NULL;
} }
// use an fcntl lock to help avoid double starting.
struct flock lock;
lock.l_type = F_WRLCK;
lock.l_start = 0;
lock.l_whence = SEEK_SET;
lock.l_len = 0;
if (fcntl(f->fd, F_SETLK, &lock) < 0) {
*res = EXTSTORE_INIT_OPEN_FAIL;
free(e);
return NULL;
}
if (ftruncate(f->fd, 0) < 0) {
*res = EXTSTORE_INIT_OPEN_FAIL;
free(e);
return NULL;
}
temp_page_count += f->page_count; temp_page_count += f->page_count;
f->offset = 0; f->offset = 0;
} }
if (temp_page_count >= UINT16_MAX) { if (temp_page_count >= UINT16_MAX) {
*res = EXTSTORE_INIT_TOO_MANY_PAGES; *res = EXTSTORE_INIT_TOO_MANY_PAGES;
free(e); free(e);
return NULL; return NULL;
} }
e->page_count = temp_page_count; e->page_count = temp_page_count;
 End of changes. 3 change blocks. 
2 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)