Skip to content

Commit

Permalink
🚨 Fix open() to support old glibc
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Jan 7, 2024
1 parent 62d3801 commit fc2731a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions project-spec/meta-user/recipes-apps/autostart/src/master.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ssize_t dump_data_frames(data_frame_t *input_data_frames, n_frame_t n_frame,
char *filename) {
// Permission denied
unlink(filename);
int fd = open(filename, O_RDWR | O_CREAT);
int fd = open(filename, O_RDWR | O_CREAT, 0644);
if (fd == -1)
return -1;
ssize_t size = 0;
Expand Down Expand Up @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) {
sprintf(filename, "%s/%d.dat", opt.out_dir, k);
// Permission denied
unlink(filename);
int fd_dat = open(filename, O_RDWR | O_CREAT);
int fd_dat = open(filename, O_RDWR | O_CREAT, 0644);
if (fd_dat == -1)
err(errno, NULL);
for (n_frame_t i = 0; i < output_frame.n_frame; i++)
Expand Down
2 changes: 1 addition & 1 deletion project-spec/meta-user/recipes-apps/autostart/src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int print_help(const struct option *longopts, const char *arg0) {
* for debug
*/
ssize_t dump_mem(char *filename, void *addr, size_t size) {
int fd = open(filename, O_RDWR | O_CREAT);
int fd = open(filename, O_RDWR | O_CREAT, 0644);
if (fd == -1)
return -1;
ssize_t _size = write(fd, addr, size);
Expand Down

0 comments on commit fc2731a

Please sign in to comment.