Only handle the values that translate.
authorDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Sat, 24 Oct 2009 21:59:43 +0000 (21:59 +0000)
committerDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Sat, 24 Oct 2009 21:59:43 +0000 (21:59 +0000)
python/vserver.py

index 081fd8a..6e5c709 100644 (file)
@@ -201,9 +201,10 @@ class VServer:
             resource_type = RLIMITS[type]
             try:
                 vserverimpl.setrlimit(self.ctx, resource_type, hard, soft, min)
-                lim = resource.getrlimit(resource_type)
-                lim = adjust_lim((hard, soft, min), lim)
-                resource.setrlimit(resource_type, lim)
+                if hasattr(resource, 'RLIMIT_' + type):
+                    lim = resource.getrlimit(resource_type)
+                    lim = adjust_lim((hard, soft, min), lim)
+                    resource.setrlimit(resource_type, lim)
             except OSError, e:
                 self.log("Error: setrlimit(%d, %s, %d, %d, %d): %s"
                          % (self.ctx, type.lower(), hard, soft, min))