From b82ab9ede1cc29a4098350b15db7a426a96f8319 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 15 Mar 2005 23:21:36 +0000 Subject: [PATCH] allow services file to be overridden with sigar.net.services.file property --- bindings/java/src/net/hyperic/sigar/NetPortMap.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/NetPortMap.java b/bindings/java/src/net/hyperic/sigar/NetPortMap.java index e35f8547..20f5be7e 100644 --- a/bindings/java/src/net/hyperic/sigar/NetPortMap.java +++ b/bindings/java/src/net/hyperic/sigar/NetPortMap.java @@ -20,12 +20,17 @@ public class NetPortMap { private static Map tcpServices = null; static { + String defaultFile; + if (SigarLoader.IS_WIN32) { - SERVICE_FILE = "C:\\windows\\system32\\drivers\\etc\\services"; + defaultFile = "C:\\windows\\system32\\drivers\\etc\\services"; } else { - SERVICE_FILE = "/etc/services"; + defaultFile = "/etc/services"; } + + SERVICE_FILE = + System.getProperty("sigar.net.services.file", defaultFile); } public static class IpEntry {