mirror of https://github.com/BOINC/boinc.git
fix a memory allocation error
report error of _DC_copyFile in message creation git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@886 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
parent
c11861ea14
commit
46ac812468
|
@ -136,7 +136,17 @@ _DC_create_message(char *box,
|
|||
if (message)
|
||||
fprintf(f, "%s", message);
|
||||
else if (msgfile)
|
||||
ret= _DC_copyFile(msgfile, fn);
|
||||
{
|
||||
if ((ret= _DC_copyFile(msgfile, fn)) != 0)
|
||||
DC_log(LOG_ERR, "copyFile(%s,%s) "
|
||||
"error: %s", msgfile, fn,
|
||||
strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
DC_log(LOG_WARNING, "No message specified for "
|
||||
"creation");
|
||||
}
|
||||
if (fsync(fileno(f)) != 0)
|
||||
DC_log(LOG_ERR, "Sync of %s: %d %s", fn,
|
||||
errno, strerror(errno));
|
||||
|
@ -171,8 +181,8 @@ _DC_nuof_messages(char *box, char *name)
|
|||
return(0);
|
||||
if ((d= opendir(box)) == NULL)
|
||||
return(0);
|
||||
s= malloc(name?strlen(name):20+100);
|
||||
name?strcpy(s, name):strcpy(s, "message");
|
||||
s= malloc(100+name?strlen(name):strlen(_DCAPI_MSG_MESSAGE));
|
||||
strcpy(s, name?name:_DCAPI_MSG_MESSAGE);
|
||||
strcat(s, ".");
|
||||
while ((de= readdir(d)) != NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue