OSSP CVS Repository

ossp - Check-in [2421]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2421
Date: 2002-Jul-29 19:42:25 (local)
2002-Jul-29 17:42:25 (UTC)
User:rse
Branch:
Comment: allow hexadecimal and octal integer values, too. (especially for file permissions)
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ch_file.c      1.22 -> 1.23     5 inserted, 1 deleted
ossp-pkg/l2/l2_ut_param.c      1.7 -> 1.8     7 inserted, 1 deleted

ossp-pkg/l2/l2_ch_file.c 1.22 -> 1.23

--- l2_ch_file.c 2002/03/13 14:49:39     1.22
+++ l2_ch_file.c 2002/07/29 17:42:25     1.23
@@ -86,6 +86,7 @@
 {
     l2_ch_file_t *cfg = (l2_ch_file_t *)ctx->vp;
     int mode;
+    mode_t mask;
 
     /* make sure a path was set */
     if (cfg->path == NULL)
@@ -97,7 +98,10 @@
         mode |= O_APPEND;
     else
         mode |= O_TRUNC;
-    if ((cfg->fd = open(cfg->path, mode, cfg->perm)) == -1)
+    mask = umask(0);
+    cfg->fd = open(cfg->path, mode, cfg->perm);
+    umask(mask);
+    if (cfg->fd == -1)
         return L2_ERR_SYS;
 
     return L2_OK;


ossp-pkg/l2/l2_ut_param.c 1.7 -> 1.8

--- l2_ut_param.c        2002/01/02 17:07:38     1.7
+++ l2_ut_param.c        2002/07/29 17:42:25     1.8
@@ -126,7 +126,13 @@
         switch (pa[i].type) {
             case L2_TYPE_INT: {
                 /* integer parameter */
-                long val = strtol(cpB, &cpE, 10);
+                long val;
+                if (strlen(cpB) > 2 && cpB[0] == '0' && cpB[1] == 'x')
+                    val = strtol(cpB+2, &cpE, 16);
+                else if (strlen(cpB) > 1 && cpB[0] == '0')
+                    val = strtol(cpB+1, &cpE, 8);
+                else
+                    val = strtol(cpB, &cpE, 10);
                 if ((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE) {
                     l2_env_errorinfo(env, L2_ERR_ARG, 
                                      "numerical parameter value out of range "

CVSTrac 2.0.1