Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

futimens: do not require O_RWONLY/O_RDWR #33

Merged
merged 1 commit into from Aug 14, 2017
Merged

futimens: do not require O_RWONLY/O_RDWR #33

merged 1 commit into from Aug 14, 2017

Conversation

ids1024
Copy link
Contributor

@ids1024 ids1024 commented Aug 14, 2017

This code, for example, should work (and does on Linux).

#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

int main() {
    int fd = open("test.txt", O_RDONLY);
    struct timespec times[2] = {{0, 0}, {0, 0}};
    if (fd == -1) {
        perror("open");
        exit(1);
    }
    if (futimens(fd, times) == -1) {
        perror("futimens");
        exit(1);
    }
}

The specific situation where I came across this was code that chmoded a file to be read only then set the times.

@jackpot51 jackpot51 merged commit 213b4ae into redox-os:master Aug 14, 2017
@ids1024 ids1024 deleted the utimens branch August 15, 2017 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants