Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f1f89cc

Browse files
adeas31OpenModelica-Hudson
authored andcommitted
Fix the zmq initialization for linux
1 parent 709531b commit f1f89cc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Compiler/runtime/zeromqimpl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ void* ZeroMQ_initialize()
8181
#else
8282
char *tmp_user = getenv("USER");
8383
if (zeroMQFileSuffix != NULL) {
84-
zeroMQFilePath = (char*)malloc(strlen(tempPath) + strlen("/openmodelica.") + tmp_user ? strlen(tmp_user) : strlen("nobody") + strlen(zeroMQFileSuffix) + 1);
85-
sprintf(zeroMQFilePath, "%s/openmodelica.%s.port.%s", tempPath, tmp_user, zeroMQFileSuffix);
84+
zeroMQFilePath = (char*)malloc(strlen(tempPath) + strlen("/openmodelica.") + (tmp_user ? strlen(tmp_user) : strlen("nobody")) + strlen(zeroMQFileSuffix) + 1);
85+
sprintf(zeroMQFilePath, "%s/openmodelica.%s.port.%s", tempPath, tmp_user ? tmp_user : "nobody", zeroMQFileSuffix);
8686
} else {
87-
zeroMQFilePath = (char*)malloc(strlen(tempPath) + strlen("/openmodelica.") + tmp_user ? strlen(tmp_user) : strlen("nobody") + 1);
88-
sprintf(zeroMQFilePath, "%s/openmodelica.%s.port", tempPath, tmp_user);
87+
zeroMQFilePath = (char*)malloc(strlen(tempPath) + strlen("/openmodelica.") + (tmp_user ? strlen(tmp_user) : strlen("nobody")) + 1);
88+
sprintf(zeroMQFilePath, "%s/openmodelica.%s.port", tempPath, tmp_user ? tmp_user : "nobody");
8989
}
9090
#endif
9191
// Create the file with port number

0 commit comments

Comments
 (0)