X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_update.c;h=62c8c3b4c50a91c776f10a2e676d76a8db2a5ca2;hb=6c6bd6077fbc7dd9caa23e73e41b62af346e1fbf;hp=5e26055a66db2fa20244860359f137f3f0b010b6;hpb=428c0dfd6c70a0e70039d15c2de3a729e01f8fef;p=rrdtool.git diff --git a/src/rrd_update.c b/src/rrd_update.c index 5e26055..62c8c3b 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -519,6 +519,7 @@ int _rrd_update( goto err_out; } + rrd_init(&rrd); if ((rrd_file = rrd_open(filename, &rrd, RRD_READWRITE)) == NULL) { goto err_free; } @@ -617,41 +618,6 @@ int _rrd_update( } /* - * get exclusive lock to whole file. - * lock gets removed when we close the file - * - * returns 0 on success - */ -int rrd_lock( - rrd_file_t *file) -{ - int rcstat; - - { -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) - struct _stat st; - - if (_fstat(file->fd, &st) == 0) { - rcstat = _locking(file->fd, _LK_NBLCK, st.st_size); - } else { - rcstat = -1; - } -#else - struct flock lock; - - lock.l_type = F_WRLCK; /* exclusive write lock */ - lock.l_len = 0; /* whole file */ - lock.l_start = 0; /* start of file */ - lock.l_whence = SEEK_SET; /* end of file */ - - rcstat = fcntl(file->fd, F_SETLK, &lock); -#endif - } - - return (rcstat); -} - -/* * Allocate some important arrays used, and initialize the template. * * When it returns, either all of the structures are allocated