Skip to content

Commit

Permalink
Use LOGMSG_P for some file operations
Browse files Browse the repository at this point in the history
  • Loading branch information
robertswiecki committed Sep 11, 2015
1 parent f28a759 commit 030fe6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions files.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool files_writeBufToFile(char *fileName, uint8_t * buf, size_t fileSz, int flag
}

if (files_writeToFd(fd, buf, fileSz) == false) {
LOGMSG(l_ERROR, "Couldn't write '%zu' bytes to file '%s' (fd='%d')", fileSz, fileName, fd);
LOGMSG_P(l_ERROR, "Couldn't write '%zu' bytes to file '%s' (fd='%d')", fileSz, fileName, fd);
close(fd);
unlink(fileName);
return false;
Expand Down Expand Up @@ -378,22 +378,22 @@ bool files_copyFile(const char *source, const char *destination, bool * dstExist

uint8_t *inFileBuf = malloc(inSt.st_size);
if (!inFileBuf) {
LOGMSG(l_ERROR, "malloc(%zu) failed", inSt.st_size);
LOGMSG_P(l_ERROR, "malloc(%zu) failed", inSt.st_size);
close(inFD);
close(outFD);
return false;
}

if (files_readFromFd(inFD, inFileBuf, (size_t) inSt.st_size) == false) {
LOGMSG(l_ERROR, "Couldn't read '%s' to a buf", source);
LOGMSG_P(l_ERROR, "Couldn't read '%s' to a buf", source);
free(inFileBuf);
close(inFD);
close(outFD);
return false;
}

if (files_writeToFd(outFD, inFileBuf, inSt.st_size) == false) {
LOGMSG(l_ERROR, "Couldn't write '%zu' bytes to file '%s' (fd='%d')", inSt.st_size,
LOGMSG_P(l_ERROR, "Couldn't write '%zu' bytes to file '%s' (fd='%d')", inSt.st_size,
destination, outFD);
free(inFileBuf);
close(inFD);
Expand Down

0 comments on commit 030fe6d

Please sign in to comment.