Add fixes from Takayuki Sasaki <sasaki@bsd.tnes.nec.co.jp>
authorDean Roehrich <roehrich@sgi.com>
Mon, 1 Oct 2001 21:39:50 +0000 (21:39 +0000)
committerDean Roehrich <roehrich@sgi.com>
Mon, 1 Oct 2001 21:39:50 +0000 (21:39 +0000)
call mk_daemon from a different place so we don't close the dmapi device.

dmapi/src/sample_hsm/migin.c
dmapi/src/sample_hsm/migout.c
dmapi/src/sample_hsm/wbee.c

index 12b04a1dcffe03f21fa3e81aea7db609ad66a1f2..9951b991eb9e41d2235c7e55f92dd2ca217c2efc 100644 (file)
@@ -111,6 +111,13 @@ main(
                logfile = LOG_DEFAULT;
         
 
+       /*
+        * Turn ourselves into a daemon
+        */
+       error = mk_daemon(logfile);
+       if (error) 
+               exit(1);
+       
        /*
         * Now we have our filesystem name and possibly a size threshold
         * to look for. Init the dmapi, and get a filesystem handle so
@@ -125,13 +132,6 @@ main(
                exit(1);
        }
 
-       /*
-        * Turn ourselves into a daemon
-        */
-       error = mk_daemon(logfile);
-       if (error) 
-               exit(1);
-       
 
        /*
         * Set the event disposition so that our session will receive 
index c7a9019451ac258b99c5ec1f966af90a523e0587..d2e8b7885338ae84843d8653d9c22aa077a2ca66 100644 (file)
@@ -469,6 +469,7 @@ extract_fields(
        char    *cp, *start;
        size_t   len;
        char *hanp;
+       char *hanpp=NULL;
 
        /*
         * Skip any leading white space, and check the length
@@ -505,8 +506,9 @@ extract_fields(
        cp += len*2;
        *cp = '\0';
 
-       atohan( hanp, (void**)&handle_buf, &len );
-
+       atohan( hanp, (void**)&hanpp, &len );
+       memcpy( handle_buf, hanpp, len);
+       free( hanpp );
 
        /* skip over white space */
        while (!isalnum(*cp))
index 95566e1a38b2b24465452b028a72c6bd97282ff1..968395574727a3eb4b2717af87819caa64c593eb 100644 (file)
@@ -453,7 +453,7 @@ clear_mrgns(
        size_t           hlen, 
        dm_token_t       token)
 {
-       dm_region_t     *rgn;
+       dm_region_t     *rgn, *sv_rgn;
        u_int            nregions, nret;
        u_int            exact_flag;
        int              i;
@@ -502,6 +502,8 @@ clear_mrgns(
                }
        }
 
+       sv_rgn = rgn;
+
        /*
         * Clear all the managed regions
         */
@@ -511,6 +513,8 @@ clear_mrgns(
                rgn->rg_flags  = DM_REGION_NOEVENT;
                rgn++;
        }
+       rgn = sv_rgn;
+
        error = dm_set_region(sid, hanp, hlen, token, nregions, rgn, 
                                &exact_flag);
        if (error == -1) {