< prev index next >
src/jdk.jdwp.agent/unix/native/libdt_socket/socket_md.c
Print this page
rev 16271 : 8170663: Fix minor issues in corelib and servicabilty coding.
Reviewed-by: dsamersoff, dholmes
Contributed-by: David CARLIER <devnexen@gmail.com>, goetz.lindenmaier@sap.com
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -194,23 +194,15 @@
return SYS_ERR;
}
} else if (cmd == SO_LINGER) {
struct linger arg;
arg.l_onoff = on;
-
- if(on) {
- arg.l_linger = (unsigned short)value.i;
- if(setsockopt(fd, SOL_SOCKET, SO_LINGER,
- (char*)&arg, sizeof(arg)) < 0) {
- return SYS_ERR;
- }
- } else {
+ arg.l_linger = (on) ? (unsigned short)value.i : 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER,
(char*)&arg, sizeof(arg)) < 0) {
return SYS_ERR;
}
- }
} else if (cmd == SO_SNDBUF) {
jint buflen = value.i;
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF,
(char *)&buflen, sizeof(buflen)) < 0) {
return SYS_ERR;
< prev index next >