提交 6cb103b6 编写于 作者: F Fabian Frederick 提交者: Linus Torvalds

fs/befs/btree.c: replace strncpy by strlcpy + coding style fixing

- strncpy + end of string assignement replaced by strlcpy

- Fix endif };

- Fix typo
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 39d7a29f
...@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node, ...@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
* Heres how it works: Key_no is the index of the key/value pair to * Heres how it works: Key_no is the index of the key/value pair to
* return in keybuf/value. * return in keybuf/value.
* Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is
* the number of charecters in the key (just a convenience). * the number of characters in the key (just a convenience).
* *
* Algorithm: * Algorithm:
* Get the first leafnode of the tree. See if the requested key is in that * Get the first leafnode of the tree. See if the requested key is in that
...@@ -502,12 +502,11 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, ...@@ -502,12 +502,11 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
"for key of size %d", __func__, bufsize, keylen); "for key of size %d", __func__, bufsize, keylen);
brelse(this_node->bh); brelse(this_node->bh);
goto error_alloc; goto error_alloc;
}; }
strncpy(keybuf, keystart, keylen); strlcpy(keybuf, keystart, keylen + 1);
*value = fs64_to_cpu(sb, valarray[cur_key]); *value = fs64_to_cpu(sb, valarray[cur_key]);
*keysize = keylen; *keysize = keylen;
keybuf[keylen] = '\0';
befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off,
cur_key, keylen, keybuf, *value); cur_key, keylen, keybuf, *value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册