diff options
author | Simon Rettberg | 2015-01-14 13:55:34 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-01-14 13:55:34 +0100 |
commit | f9b94dcafa867c38dfaeb9b24f37b392d1ad80d8 (patch) | |
tree | 9343235020bbdd8a70b4096c54da58c3dfe757ac /src/server/uplink.c | |
parent | [SERVER] Fix stupid bug (not using errno) (diff) | |
download | dnbd3-f9b94dcafa867c38dfaeb9b24f37b392d1ad80d8.tar.gz dnbd3-f9b94dcafa867c38dfaeb9b24f37b392d1ad80d8.tar.xz dnbd3-f9b94dcafa867c38dfaeb9b24f37b392d1ad80d8.zip |
[SERVER] Crank up warning levels of gcc and fix them all (mostly sign compare and some unused params)
Also allow newline at end of alt-servers file without complaining about it
not being a valid alt server definition.
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r-- | src/server/uplink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c index 0b526fd..cc82fe0 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -458,12 +458,11 @@ static void uplink_sendReplicationRequest(dnbd3_connection_t *link) spin_unlock( &image->lock ); return; } - const size_t len = IMGSIZE_TO_MAPBYTES( image->filesize ) - 1; + const int len = IMGSIZE_TO_MAPBYTES( image->filesize ) - 1; const uint32_t requestBlockSize = DNBD3_BLOCK_SIZE * 8; for (int i = 0; i <= len; ++i) { if ( image->cache_map == NULL || link->fd == -1 ) break; if ( image->cache_map[i] == 0xff || (i == len && link->replicatedLastBlock) ) continue; - if ( i == len ) link->replicatedLastBlock = true; // Special treatment, last byte in map could represent less than 8 blocks link->replicationHandle = 1; // Prevent race condition spin_unlock( &image->lock ); // Unlocked - do not break or continue here... @@ -474,6 +473,7 @@ static void uplink_sendReplicationRequest(dnbd3_connection_t *link) printf( "[DEBUG] Error sending background replication request to uplink server!\n" ); return; } + if ( i == len ) link->replicatedLastBlock = true; // Special treatment, last byte in map could represent less than 8 blocks return; // Request was sent, bail out, nothing is locked } spin_unlock( &image->lock ); |