summaryrefslogtreecommitdiffstats
path: root/src/fopenmkdir.c
diff options
context:
space:
mode:
authorAnton L. Šijanec <anton@sijanec.eu>2020-05-01 15:18:12 +0200
committerAnton L. Šijanec <anton@sijanec.eu>2020-05-01 15:18:12 +0200
commit6961e4237f24306ab2475f4f527a7c802134c4d9 (patch)
tree0d18e9dd78fe3dee482872a65fbf823e00cd31db /src/fopenmkdir.c
parentfolder structure README.mf (diff)
downloadbverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.gz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.bz2
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.lz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.xz
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.tar.zst
bverbose-6961e4237f24306ab2475f4f527a7c802134c4d9.zip
Diffstat (limited to 'src/fopenmkdir.c')
-rw-r--r--src/fopenmkdir.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/fopenmkdir.c b/src/fopenmkdir.c
index e4c4d68..afca4f1 100644
--- a/src/fopenmkdir.c
+++ b/src/fopenmkdir.c
@@ -1,13 +1,14 @@
+#pragma once
#include <mkdirp.c>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
+#include <limits.h>
FILE * fopen_mkdir(char* filename, char* mode) {
FILE * file_to_return;
file_to_return = fopen(filename, mode);
if(file_to_return == NULL) {
- char folder_of_file[256];
+ char folder_of_file[PATH_MAX];
strcpy(folder_of_file, filename);
char * p;
p = strrchr(folder_of_file, '/');
@@ -15,8 +16,8 @@ FILE * fopen_mkdir(char* filename, char* mode) {
printf("[fopenmkdir.c] filename contains no slash.\n");
return NULL;
} else {
- printf("folder is %s\n", folder_of_file);
- printf("filename is %s\n", filename);
+ // printf("folder is %s\n", folder_of_file);
+ // printf("filename is %s\n", filename);
*p = '\0';
}
if(mkdir_p(folder_of_file) != 0) {