mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
652e2ab610
Signed-off-by: Shea Levy <shea@shealevy.com>
21 lines
333 B
C
21 lines
333 B
C
#include <sys/statvfs.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char ** argv) {
|
|
struct statvfs stat;
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: %s PATH", argv[0]);
|
|
exit(2);
|
|
}
|
|
if (statvfs(argv[1], &stat) != 0) {
|
|
perror("statvfs");
|
|
exit(3);
|
|
}
|
|
if (stat.f_flag & ST_RDONLY)
|
|
exit(0);
|
|
else
|
|
exit(1);
|
|
}
|
|
|