apache-commons-io/0001-Fix-Files.size-failing-when-symlink-target-is-non-ex.patch
DistroBaker 38c3db7193 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/apache-commons-io.git#ecb0785573de676a72bd3cfe70466e05135f46d8
2021-02-05 23:23:06 +00:00

26 lines
1.1 KiB
Diff

From 610065347bbbc8fea366de32e558de4977807e52 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Wed, 3 Feb 2021 19:45:13 +0000
Subject: [PATCH] Fix Files.size failing when symlink target is non-existant
---
src/main/java/org/apache/commons/io/file/PathUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/io/file/PathUtils.java b/src/main/java/org/apache/commons/io/file/PathUtils.java
index d370ef0b..b38a46a0 100644
--- a/src/main/java/org/apache/commons/io/file/PathUtils.java
+++ b/src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -358,7 +358,7 @@ public static PathCounters deleteFile(final Path file, final DeleteOption... opt
}
final PathCounters pathCounts = Counters.longPathCounters();
final boolean exists = Files.exists(file, LinkOption.NOFOLLOW_LINKS);
- final long size = exists ? Files.size(file) : 0;
+ final long size = exists && Files.exists(file) ? Files.size(file) : 0;
if (overrideReadOnly(options) && exists) {
setReadOnly(file, false, LinkOption.NOFOLLOW_LINKS);
}
--
2.28.0