Show errno when fail to open file pointer

This commit is contained in:
MysterD 2022-06-04 17:20:41 -07:00
parent 91ad974684
commit 2e1818394e

View file

@ -1,4 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <string.h>
#include "../network.h" #include "../network.h"
#include "pc/djui/djui.h" #include "pc/djui/djui.h"
#include "pc/mods/mods.h" #include "pc/mods/mods.h"
@ -287,7 +289,7 @@ after_filled:;
packet_write(&p, &chunk, sizeof(u8) * chunkFill); packet_write(&p, &chunk, sizeof(u8) * chunkFill);
network_send_to(0, &p); network_send_to(0, &p);
LOG_INFO("Sent chunk: offset %llu, length %llu", requestOffset, chunkFill); //LOG_INFO("Sent chunk: offset %llu, length %llu", requestOffset, chunkFill);
} }
static void open_mod_file(struct Mod* mod, struct ModFile* file) { static void open_mod_file(struct Mod* mod, struct ModFile* file) {
@ -305,7 +307,7 @@ static void open_mod_file(struct Mod* mod, struct ModFile* file) {
file->fp = fopen(fullPath, "wb"); file->fp = fopen(fullPath, "wb");
if (file->fp == NULL) { if (file->fp == NULL) {
LOG_ERROR("unable to open for write: '%s'", fullPath); LOG_ERROR("unable to open for write: '%s' - '%s'", fullPath, strerror(errno));
return; return;
} }
LOG_INFO("Opened mod file pointer: %s", fullPath); LOG_INFO("Opened mod file pointer: %s", fullPath);