Skip to content

Commit

Permalink
xicodomingues#78 fix permission when opening file with create flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Rodriguez committed Nov 1, 2023
1 parent 57762fb commit 5541a4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/libft/fsoares/test_putchar_fd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "my_utils.h"
#include <errno.h>

int single_test_putchar(int test_n, char c, int fd)
{
Expand All @@ -11,7 +12,7 @@ int single_test_putchar(int test_n, char c, int fd)

int test_putchar_fd()
{
int fd = open("fsoares", O_RDWR | O_CREAT);
int fd = open("fsoares", O_RDWR | O_CREAT, 0666);

int res = single_test_putchar(1, 'a', fd);
res = single_test_putchar(2, 'x', fd) && res;
Expand Down
3 changes: 2 additions & 1 deletion tests/libft/fsoares/test_putendl_fd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "my_utils.h"
#include <errno.h>

int single_test_putendl(int test_number, char *str, int fd)
{
Expand All @@ -11,7 +12,7 @@ int single_test_putendl(int test_number, char *str, int fd)

int test_putendl_fd()
{
int fd = open("fsoares", O_RDWR | O_CREAT);
int fd = open("fsoares", O_RDWR | O_CREAT, 0666);

int res = single_test_putendl(1, "", fd);
res = single_test_putendl(2, "abcdef", fd) && res;
Expand Down
3 changes: 2 additions & 1 deletion tests/libft/fsoares/test_putnbr_fd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "my_utils.h"
#include <errno.h>

int single_test_putnbr(int test_number, int n, int fd)
{
Expand All @@ -12,7 +13,7 @@ int single_test_putnbr(int test_number, int n, int fd)

int test_putnbr_fd()
{
int fd = open("fsoares", O_RDWR | O_CREAT);
int fd = open("fsoares", O_RDWR | O_CREAT, 0666);

int res = single_test_putnbr(1, 0, fd);
res = single_test_putnbr(2, 10000043, fd) && res;
Expand Down
3 changes: 2 additions & 1 deletion tests/libft/fsoares/test_putstr_fd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "my_utils.h"
#include <errno.h>

int single_test_putstr(int test_number, char *str, int fd)
{
Expand All @@ -11,7 +12,7 @@ int single_test_putstr(int test_number, char *str, int fd)

int test_putstr_fd()
{
int fd = open("fsoares", O_RDWR | O_CREAT);
int fd = open("fsoares", O_RDWR | O_CREAT, 0666);

int res = single_test_putstr(1, "abcdef", fd);
res = single_test_putstr(2, "\n1234", fd) && res;
Expand Down

0 comments on commit 5541a4f

Please sign in to comment.