[Refdb-cvs] CVS: refdb/src authorinfo.c,1.2,1.3
Status: Beta
Brought to you by:
mhoenicka
|
From: Markus H. <mho...@us...> - 2003-12-28 00:59:47
|
Update of /cvsroot/refdb/refdb/src
In directory sc8-pr-cvs1:/tmp/cvs-serv21469
Modified Files:
authorinfo.c
Log Message:
set_authorinfo_role(): if role is NULL, dont bail out but truncate the string
Index: authorinfo.c
===================================================================
RCS file: /cvsroot/refdb/refdb/src/authorinfo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -U2 -r1.2 -r1.3
--- authorinfo.c 7 Oct 2003 22:56:34 -0000 1.2
+++ authorinfo.c 28 Dec 2003 00:43:19 -0000 1.3
@@ -348,11 +348,17 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
char* set_authorinfo_role(struct AUTHOR_INFO* ptr_ainfo, const char* role) {
- if (!ptr_ainfo || !role) {
+ if (!ptr_ainfo) {
return NULL;
}
- /* truncate string */
- strncpy(ptr_ainfo->role, role, 64);
- (ptr_ainfo->role)[63] = '\0';
+ if (role) {
+ /* truncate string */
+ strncpy(ptr_ainfo->role, role, 64);
+ (ptr_ainfo->role)[63] = '\0';
+ }
+ else {
+ *(ptr_ainfo->role) = '\0';
+ }
+
return ptr_ainfo->role;
}
|