]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - tools-util.c
Update bcachefs sources to 24c6361e20 bcachefs: Fix a trans path overflow in bch2_btr...
[bcachefs-tools-debian] / tools-util.c
index baf24ae57eb6bf5c6198befb0598c3a351e045bb..f29d202618db4623e73284eafa8ec47eadae5ced 100644 (file)
@@ -128,6 +128,17 @@ struct stat xstat(const char *path)
 
 /* File parsing (i.e. sysfs) */
 
+void write_file_str(int dirfd, const char *path, const char *str)
+{
+       int fd = xopenat(dirfd, path, O_WRONLY);
+       ssize_t wrote, len = strlen(str);
+
+       wrote = write(fd, str, len);
+       if (wrote != len)
+               die("read error: %m");
+       close(fd);
+}
+
 char *read_file_str(int dirfd, const char *path)
 {
        int fd = xopenat(dirfd, path, O_RDONLY);