added proper expression for comparing write & fread return values
still not complete tho
This commit is contained in:
parent
8df7a56095
commit
fd6aa19eba
@ -58,7 +58,7 @@ outputFlags encryptText(char *text, char *keyNew)
|
||||
|
||||
//TRY TO MAKE RANDOM GENERATION REALLY "RANDOM"
|
||||
fileBuffer = fopen("/dev/urandom", "r");
|
||||
if (fread(&numberBuffer, sizeof(numberBuffer), 1, fileBuffer) == 0) abort(); //TODO: Make it safe
|
||||
if (fread(&numberBuffer, sizeof(numberBuffer), 1, fileBuffer) != 1) abort(); //TODO: Make it safe
|
||||
srand(numberBuffer);
|
||||
numberBuffer = abs(numberBuffer); //MAKE numberBuffer POSITIVE
|
||||
|
||||
|
@ -141,7 +141,7 @@ boolean checkVersion()
|
||||
strcpy(buffer, "");
|
||||
|
||||
//LOAD jsonFile
|
||||
if (fread(buffer, bufferSize, 1, fileBuffer) == 0) abort(); //TODO: Make it safe
|
||||
if (fread(buffer, bufferSize, 1, fileBuffer) != 1) abort(); //TODO: Make it safe
|
||||
|
||||
buffer[bufferSize] = '\0';
|
||||
|
||||
|
@ -99,7 +99,7 @@ void writeLog(int loggerFile, char *logMessage)
|
||||
|
||||
sprintf(buffer, WRITE_FORMATTING, tm.tm_hour, tm.tm_min, tm.tm_sec, logMessage); //LOAD MESSAGE
|
||||
|
||||
if (write(loggerFile, buffer, strlen(buffer)) == 0) abort(); //WRITE (YAY) //TODO: Find why the fuck you can't use version line bellow
|
||||
if (write(loggerFile, buffer, strlen(buffer)) != (ssize_t) strlen(buffer)) abort(); //WRITE (YAY) //TODO: Find why the fuck you can't use version line bellow
|
||||
//(void) write(loggerFile, buffer, strlen(buffer));
|
||||
|
||||
//DEALLOCATION
|
||||
|
@ -40,7 +40,7 @@ int main(void)
|
||||
buffer = malloc(bufferSize + 1);
|
||||
|
||||
//LOAD jsonFile
|
||||
if (fread(buffer, bufferSize, 1, fileBuffer) == 0) abort(); //TODO: Make it safe
|
||||
if (fread(buffer, bufferSize, 1, fileBuffer) != 1) abort(); //TODO: Make it safe
|
||||
|
||||
printf("%s\n", buffer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user