As we use negative errno in many places, there were two conversion that
assigned a negative value there, which is wrong.
Note that in many other places we do 'errno = ret' but that's for
pthread_* or posix_memalign() functions that return errno directly.
Signed-off-by: David Sterba <dsterba@suse.com>
} else if (ret <= 0) {
if (ret == 0)
ret = -EEXIST;
- errno = ret ;
+ errno = -ret ;
error("failed to check directory %s before creation: %m", p);
goto out;
}
ret = pwrite(fp, &disk_super, BTRFS_SUPER_INFO_SIZE, BTRFS_SUPER_INFO_OFFSET);
if (ret != BTRFS_SUPER_INFO_SIZE) {
- if (ret < 0) {
- errno = ret;
+ if (ret < 0)
error("cannot write superblock: %m");
- } else {
+ else
error("cannot write superblock");
- }
ret = -EIO;
goto out;
}