Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • R redoxfs
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-osredox-os
  • redoxfs
  • Merge requests
  • !33

futimens: do not require O_RWONLY/O_RDWR

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Ian Douglas Scott requested to merge ids1024:utimens into master Aug 14, 2017
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 2

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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: ids1024:utimens