UnixChannelFactory.java (11083:e5b66323ae45) UnixChannelFactory.java (11982:eb7d3e11a8cb)
1/*
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 256 unchanged lines hidden (view full) ---

265 // handle ELOOP to avoid confusing message
266 if (!followLinks && (x.errno() == ELOOP)) {
267 x = new UnixException(x.getMessage() + " (NOFOLLOW_LINKS specified)");
268 }
269
270 throw x;
271 }
272
1/*
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 256 unchanged lines hidden (view full) ---

265 // handle ELOOP to avoid confusing message
266 if (!followLinks && (x.errno() == ELOOP)) {
267 x = new UnixException(x.getMessage() + " (NOFOLLOW_LINKS specified)");
268 }
269
270 throw x;
271 }
272
273 // fail if the file is a directory
274 if (flags.read) {
275 UnixException exc = null;
276 try {
277 if (UnixFileAttributes.get(fd).isDirectory()) {
278 exc = new UnixException(EISDIR);
279 }
280 } catch (UnixException x) {
281 exc = x;
282 }
283 if (exc != null) {
284 close(fd);
285 throw exc;
286 }
287 }
288
289 // unlink file immediately if delete on close. The spec is clear that
290 // an implementation cannot guarantee to unlink the correct file when
291 // replaced by an attacker after it is opened.
292 if (flags.deleteOnClose) {
293 try {
294 if (dfd >= 0) {
295 unlinkat(dfd, path.asByteArray(), 0);
296 } else {

--- 14 unchanged lines hidden ---
273 // unlink file immediately if delete on close. The spec is clear that
274 // an implementation cannot guarantee to unlink the correct file when
275 // replaced by an attacker after it is opened.
276 if (flags.deleteOnClose) {
277 try {
278 if (dfd >= 0) {
279 unlinkat(dfd, path.asByteArray(), 0);
280 } else {

--- 14 unchanged lines hidden ---