diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -22,6 +22,7 @@ * distrenslave -c username email@example.com */ +#include "asprintf.h" #include "slavefuncs.h" #include "blendjob.h" #include "execio.h" @@ -109,12 +110,6 @@ int curlpost(char *filename, char *url){ return 0; } -/** Converts an integer to a string, currently a stub. */ -char *int_to_str(int nbr) -{ - return(NULL); -} - /** Generates a SSH key with ssh-keygen */ int ssh_keygen(){ /* Checks to see if the keys are already present. */ @@ -318,18 +313,22 @@ return 1; // Success /** Executor function for Blender operations */ void exec_blender(struct blendjob* blendjob, char *input, char *output, int frame) { - char *frame_str = int_to_str(frame); // Converts the int frame to a string, so it can be in the cmd array. + int ret; + char *frame_str; + /* start execio code */ - char *command = "blender"; // @TODO: append .exe if win32? - int ret; - char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL }; + char *command = "blender"; // @TODO: append .exe if win32? + char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL }; + + char buf[10]; + struct execio *testrem; + size_t readlen; - char buf[10]; - struct execio *testrem; - size_t readlen; - ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production - buf[9] = '\0'; // null-terminating the array... - while(!execio_read(testrem, buf, 9, &readlen)) + _distren_asprintf(&frame_str, "%i", frame); + + ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production + buf[9] = '\0'; // null-terminating the array... + while(!execio_read(testrem, buf, 9, &readlen)) { if(readlen > 9) { fprintf(stderr, "Something is terribly wrong!\n"); diff --git a/src/server/slavefuncs.h b/src/server/slavefuncs.h --- a/src/server/slavefuncs.h +++ b/src/server/slavefuncs.h @@ -26,7 +26,6 @@ size_t curl_writetodisk(void *ptr, size_t size, size_t nmemb, FILE *stream); int curlget(char *url, char *out); int curlpost(char *filename, char *url); -char *int_to_str(int nbr); int ssh_keygen(); int register_user(char *username, char *email); int login_user(char *username);