Commit fe19e89b authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Rephrase buffer allocation/filling.

parent 7c531df4
...@@ -723,9 +723,9 @@ int fowPOSIXASYNCH ( const char *filename ) ...@@ -723,9 +723,9 @@ int fowPOSIXASYNCH ( const char *filename )
size_t l = strlen(filename) + strlen(message) + 2; size_t l = strlen(filename) + strlen(message) + 2;
char *temp = xmalloc(l + 1); char *temp = xmalloc(l + 1);
strncpy(temp, (char *)afd->db->buffer, l); strncpy(temp, (char *)afd->db->buffer, l);
temp[l] = '\0'; temp[l] = '\0';
xdebug ( "filename=%s, put Open file message on buffer:\n%s,\t return", xdebug("filename=%s, put Open file message on buffer:\n%s,\t return",
filename, temp); filename, temp);
free(temp); free(temp);
} }
......
...@@ -579,8 +579,6 @@ int fowPOSIXNONB ( const char *filename ) ...@@ -579,8 +579,6 @@ int fowPOSIXNONB ( const char *filename )
static long buffersize = 0; static long buffersize = 0;
int root = 0, id, iret, messageLength = 32; int root = 0, id, iret, messageLength = 32;
char message[messageLength]; char message[messageLength];
size_t l;
char *temp;
/* broadcast buffersize to collectors */ /* broadcast buffersize to collectors */
...@@ -621,13 +619,13 @@ int fowPOSIXNONB ( const char *filename ) ...@@ -621,13 +619,13 @@ int fowPOSIXNONB ( const char *filename )
if ( ddebug ) if ( ddebug )
{ {
l = strlen ( filename ) + strlen ( message ) + 2; size_t l = strlen(filename) + strlen(message) + 2;
temp = xmalloc (( l + 1 ) * sizeof ( char )); char *temp = xmalloc(l + 1);
strncpy ( temp, ( char * ) afd->db->buffer, ( size_t ) l ); strncpy(temp, (char *)afd->db->buffer, l);
temp[l] = '\0'; temp[l] = '\0';
xdebug("filename=%s, put Open file message on buffer:\n%s,\t return", xdebug("filename=%s, put Open file message on buffer:\n%s,\t return",
filename, temp); filename, temp);
free ( temp ); free(temp);
} }
return id; return id;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment