<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>lib/cpio.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.17 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>lib/cpio.c</h1><a href="cpio_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 00010 <span class="preprocessor">#include "<a class="code" href="system_8h.html">system.h</a>"</span> 00011 00012 <span class="preprocessor">#include "<a class="code" href="fsm_8h.html">fsm.h</a>"</span> 00013 <span class="preprocessor">#include "<a class="code" href="rpmerr_8h.html">rpmerr.h</a>"</span> 00014 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span> 00015 00016 <span class="comment">/*@access FSM_t @*/</span> 00017 00018 <span class="comment">/*@-exportheadervar@*/</span> <a name="l00019"></a><a class="code" href="cpio_8c.html#a2">00019</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="cpio_8c.html#a2">_fsm_debug</a>; 00020 <span class="comment">/*@=exportheadervar@*/</span> 00021 <a name="l00030"></a><a class="code" href="cpio_8c.html#a3">00030</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="cpio_8c.html#a3">strntoul</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *str, <span class="comment">/*@out@*/</span><span class="keywordtype">char</span> **endptr, <span class="keywordtype">int</span> base, <span class="keywordtype">int</span> num) 00031 <span class="comment">/*@modifies *endptr @*/</span> 00032 { 00033 <span class="keywordtype">char</span> * buf, * end; 00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ret; 00035 00036 buf = <a class="code" href="system_8h.html#a36">alloca</a>(num + 1); 00037 strncpy(buf, str, num); 00038 buf[num] = <span class="charliteral">'\0'</span>; 00039 00040 ret = strtoul(buf, &end, base); 00041 <span class="keywordflow">if</span> (*end != <span class="charliteral">'\0'</span>) 00042 *endptr = ((<span class="keywordtype">char</span> *)str) + (end - buf); <span class="comment">/* XXX discards const */</span> 00043 <span class="keywordflow">else</span> 00044 *endptr = ((<span class="keywordtype">char</span> *)str) + strlen(buf); 00045 00046 <span class="keywordflow">return</span> ret; 00047 } 00048 <a name="l00049"></a><a class="code" href="cpio_8c.html#a0">00049</a> <span class="preprocessor">#define GET_NUM_FIELD(phys, log) \</span> 00050 <span class="preprocessor"> log = strntoul(phys, &end, 16, sizeof(phys)); \</span> 00051 <span class="preprocessor"> if ( (end - phys) != sizeof(phys) ) return CPIOERR_BAD_HEADER;</span> <a name="l00052"></a><a class="code" href="cpio_8c.html#a1">00052</a> <span class="preprocessor"></span><span class="preprocessor">#define SET_NUM_FIELD(phys, val, space) \</span> 00053 <span class="preprocessor"> sprintf(space, "%8.8lx", (unsigned long) (val)); \</span> 00054 <span class="preprocessor"> memcpy(phys, space, 8);</span> 00055 <span class="preprocessor"></span> <a name="l00056"></a><a class="code" href="cpio_8c.html#a4">00056</a> <span class="keywordtype">int</span> <a class="code" href="cpio_8c.html#a4">cpioTrailerWrite</a>(<a class="code" href="structfsm__s.html">FSM_t</a> fsm) 00057 { 00058 <span class="keyword">struct </span><a class="code" href="structcpioCrcPhysicalHeader.html">cpioCrcPhysicalHeader</a> * hdr = 00059 (<span class="keyword">struct </span><a class="code" href="structcpioCrcPhysicalHeader.html">cpioCrcPhysicalHeader</a> *)fsm->rdbuf; 00060 <span class="keywordtype">int</span> rc; 00061 00062 memset(hdr, <span class="charliteral">'0'</span>, <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a>); 00063 memcpy(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>, <a class="code" href="cpio_8h.html#a1">CPIO_NEWC_MAGIC</a>, <span class="keyword">sizeof</span>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>)); 00064 memcpy(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m5">nlink</a>, <span class="stringliteral">"00000001"</span>, 8); 00065 memcpy(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m12">namesize</a>, <span class="stringliteral">"0000000b"</span>, 8); 00066 memcpy(fsm->rdbuf + <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a>, <a class="code" href="cpio_8h.html#a3">CPIO_TRAILER</a>, <span class="keyword">sizeof</span>(<a class="code" href="cpio_8h.html#a3">CPIO_TRAILER</a>)); 00067 00068 <span class="comment">/* XXX DWRITE uses rdnb for I/O length. */</span> 00069 fsm->rdnb = <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a> + <span class="keyword">sizeof</span>(CPIO_TRAILER); 00070 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a55">FSM_DWRITE</a>); 00071 00072 <span class="comment">/*</span> 00073 <span class="comment"> * GNU cpio pads to 512 bytes here, but we don't. This may matter for</span> 00074 <span class="comment"> * tape device(s) and/or concatenated cpio archives. <shrug></span> 00075 <span class="comment"> */</span> 00076 <span class="keywordflow">if</span> (!rc) 00077 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a50">FSM_PAD</a>); 00078 00079 <span class="keywordflow">return</span> rc; 00080 } 00081 <a name="l00082"></a><a class="code" href="cpio_8c.html#a5">00082</a> <span class="keywordtype">int</span> <a class="code" href="cpio_8c.html#a5">cpioHeaderWrite</a>(<a class="code" href="structfsm__s.html">FSM_t</a> fsm, <span class="keyword">struct</span> stat * st) 00083 { 00084 <span class="keyword">struct </span><a class="code" href="structcpioCrcPhysicalHeader.html">cpioCrcPhysicalHeader</a> * hdr = (<span class="keyword">struct </span><a class="code" href="structcpioCrcPhysicalHeader.html">cpioCrcPhysicalHeader</a> *)fsm->rdbuf; 00085 <span class="keywordtype">char</span> field[64]; 00086 size_t len; 00087 dev_t dev; 00088 <span class="keywordtype">int</span> rc = 0; 00089 00090 memcpy(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>, <a class="code" href="cpio_8h.html#a1">CPIO_NEWC_MAGIC</a>, <span class="keyword">sizeof</span>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>)); 00091 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m1">inode</a>, st->st_ino, field); 00092 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m2">mode</a>, st->st_mode, field); 00093 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m3">uid</a>, st->st_uid, field); 00094 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m4">gid</a>, st->st_gid, field); 00095 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m5">nlink</a>, st->st_nlink, field); 00096 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m6">mtime</a>, st->st_mtime, field); 00097 <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m7">filesize</a>, st->st_size, field); 00098 00099 dev = <a class="code" href="system_8h.html#a0">major</a>((<span class="keywordtype">unsigned</span>)st->st_dev); <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m8">devMajor</a>, dev, field); 00100 dev = <a class="code" href="system_8h.html#a1">minor</a>((<span class="keywordtype">unsigned</span>)st->st_dev); <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m9">devMinor</a>, dev, field); 00101 dev = <a class="code" href="system_8h.html#a0">major</a>((<span class="keywordtype">unsigned</span>)st->st_rdev); <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m10">rdevMajor</a>, dev, field); 00102 dev = <a class="code" href="system_8h.html#a1">minor</a>((<span class="keywordtype">unsigned</span>)st->st_rdev); <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m11">rdevMinor</a>, dev, field); 00103 00104 len = strlen(fsm->path) + 1; <a class="code" href="cpio_8c.html#a1">SET_NUM_FIELD</a>(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m12">namesize</a>, len, field); 00105 memcpy(hdr-><a class="code" href="structcpioCrcPhysicalHeader.html#m13">checksum</a>, <span class="stringliteral">"00000000"</span>, 8); 00106 memcpy(fsm->rdbuf + <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a>, fsm->path, len); 00107 00108 <span class="comment">/* XXX DWRITE uses rdnb for I/O length. */</span> 00109 fsm->rdnb = <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a> + len; 00110 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a55">FSM_DWRITE</a>); 00111 <span class="keywordflow">if</span> (!rc && fsm->rdnb != fsm->wrnb) 00112 rc = <a class="code" href="group__payload.html#a24a11">CPIOERR_WRITE_FAILED</a>; 00113 <span class="keywordflow">if</span> (!rc) 00114 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a50">FSM_PAD</a>); 00115 <span class="keywordflow">return</span> rc; 00116 } 00117 <a name="l00118"></a><a class="code" href="cpio_8c.html#a6">00118</a> <span class="keywordtype">int</span> <a class="code" href="cpio_8c.html#a6">cpioHeaderRead</a>(<a class="code" href="structfsm__s.html">FSM_t</a> fsm, <span class="keyword">struct</span> stat * st) 00119 <span class="comment">/*@modifies fsm, *st @*/</span> 00120 { 00121 <span class="keyword">struct </span><a class="code" href="structcpioCrcPhysicalHeader.html">cpioCrcPhysicalHeader</a> hdr; 00122 <span class="keywordtype">int</span> nameSize; 00123 <span class="keywordtype">char</span> * end; 00124 <span class="keywordtype">int</span> <a class="code" href="system_8h.html#a0">major</a>, <a class="code" href="system_8h.html#a1">minor</a>; 00125 <span class="keywordtype">int</span> rc = 0; 00126 00127 fsm-><a class="code" href="structfsm__s.html#m13">wrlen</a> = <a class="code" href="cpio_8h.html#a4">PHYS_HDR_SIZE</a>; 00128 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a54">FSM_DREAD</a>); 00129 <span class="keywordflow">if</span> (!rc && fsm-><a class="code" href="structfsm__s.html#m8">rdnb</a> != fsm-><a class="code" href="structfsm__s.html#m13">wrlen</a>) 00130 rc = <a class="code" href="group__payload.html#a24a24">CPIOERR_READ_FAILED</a>; 00131 <span class="keywordflow">if</span> (rc) <span class="keywordflow">return</span> rc; 00132 memcpy(&hdr, fsm-><a class="code" href="structfsm__s.html#m10">wrbuf</a>, fsm-><a class="code" href="structfsm__s.html#m8">rdnb</a>); 00133 00134 <span class="keywordflow">if</span> (strncmp(<a class="code" href="cpio_8h.html#a2">CPIO_CRC_MAGIC</a>, hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>, <span class="keyword">sizeof</span>(<a class="code" href="cpio_8h.html#a2">CPIO_CRC_MAGIC</a>)-1) && 00135 strncmp(<a class="code" href="cpio_8h.html#a1">CPIO_NEWC_MAGIC</a>, hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m0">magic</a>, <span class="keyword">sizeof</span>(<a class="code" href="cpio_8h.html#a1">CPIO_NEWC_MAGIC</a>)-1)) 00136 <span class="keywordflow">return</span> <a class="code" href="group__payload.html#a24a6">CPIOERR_BAD_MAGIC</a>; 00137 00138 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m1">inode</a>, st->st_ino); 00139 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m2">mode</a>, st->st_mode); 00140 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m3">uid</a>, st->st_uid); 00141 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m4">gid</a>, st->st_gid); 00142 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m5">nlink</a>, st->st_nlink); 00143 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m6">mtime</a>, st->st_mtime); 00144 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m7">filesize</a>, st->st_size); 00145 00146 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m8">devMajor</a>, <a class="code" href="system_8h.html#a0">major</a>); 00147 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m9">devMinor</a>, <a class="code" href="system_8h.html#a1">minor</a>); 00148 <span class="comment">/*@-shiftimplementation@*/</span> 00149 st->st_dev = <a class="code" href="system_8h.html#a2">makedev</a>(<a class="code" href="system_8h.html#a0">major</a>, <a class="code" href="system_8h.html#a1">minor</a>); 00150 <span class="comment">/*@=shiftimplementation@*/</span> 00151 00152 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m10">rdevMajor</a>, <a class="code" href="system_8h.html#a0">major</a>); 00153 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m11">rdevMinor</a>, <a class="code" href="system_8h.html#a1">minor</a>); 00154 <span class="comment">/*@-shiftimplementation@*/</span> 00155 st->st_rdev = <a class="code" href="system_8h.html#a2">makedev</a>(<a class="code" href="system_8h.html#a0">major</a>, <a class="code" href="system_8h.html#a1">minor</a>); 00156 <span class="comment">/*@=shiftimplementation@*/</span> 00157 00158 <a class="code" href="cpio_8c.html#a0">GET_NUM_FIELD</a>(hdr.<a class="code" href="structcpioCrcPhysicalHeader.html#m12">namesize</a>, nameSize); 00159 <span class="keywordflow">if</span> (nameSize >= fsm-><a class="code" href="structfsm__s.html#m12">wrsize</a>) 00160 <span class="keywordflow">return</span> <a class="code" href="group__payload.html#a24a7">CPIOERR_BAD_HEADER</a>; 00161 00162 { <span class="keywordtype">char</span> * t = <a class="code" href="rpmmalloc_8c.html#a1">xmalloc</a>(nameSize + 1); 00163 fsm-><a class="code" href="structfsm__s.html#m13">wrlen</a> = nameSize; 00164 rc = <a class="code" href="fsm_8c.html#a38">fsmStage</a>(fsm, <a class="code" href="fsm_8h.html#a73a54">FSM_DREAD</a>); 00165 <span class="keywordflow">if</span> (!rc && fsm-><a class="code" href="structfsm__s.html#m8">rdnb</a> != fsm-><a class="code" href="structfsm__s.html#m13">wrlen</a>) 00166 rc = <a class="code" href="group__payload.html#a24a7">CPIOERR_BAD_HEADER</a>; 00167 <span class="keywordflow">if</span> (rc) { 00168 t = <a class="code" href="poptint_8h.html#a14">_free</a>(t); 00169 fsm-><a class="code" href="structfsm__s.html#m0">path</a> = NULL; 00170 <span class="keywordflow">return</span> rc; 00171 } 00172 memcpy(t, fsm-><a class="code" href="structfsm__s.html#m10">wrbuf</a>, fsm-><a class="code" href="structfsm__s.html#m8">rdnb</a>); 00173 t[nameSize] = <span class="charliteral">'\0'</span>; 00174 fsm-><a class="code" href="structfsm__s.html#m0">path</a> = t; 00175 } 00176 00177 <span class="keywordflow">return</span> 0; 00178 } 00179 <a name="l00180"></a><a class="code" href="group__payload.html#a4">00180</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keyword">const</span> <a class="code" href="group__payload.html#a4">cpioStrerror</a>(<span class="keywordtype">int</span> rc) 00181 { 00182 <span class="keyword">static</span> <span class="keywordtype">char</span> msg[256]; 00183 <span class="keywordtype">char</span> *s; 00184 <span class="keywordtype">int</span> l, myerrno = <a class="code" href="system_8h.html#a29">errno</a>; 00185 00186 strcpy(msg, <span class="stringliteral">"cpio: "</span>); 00187 <span class="comment">/*@-branchstate@*/</span> 00188 <span class="keywordflow">switch</span> (rc) { 00189 <span class="keywordflow">default</span>: 00190 s = msg + strlen(msg); 00191 sprintf(s, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"(error 0x%x)"</span>), (<span class="keywordtype">unsigned</span>)rc); 00192 s = NULL; 00193 <span class="keywordflow">break</span>; 00194 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a6">CPIOERR_BAD_MAGIC</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Bad magic"</span>); <span class="keywordflow">break</span>; 00195 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a7">CPIOERR_BAD_HEADER</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Bad/unreadable header"</span>);<span class="keywordflow">break</span>; 00196 00197 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a8">CPIOERR_OPEN_FAILED</a>: s = <span class="stringliteral">"open"</span>; <span class="keywordflow">break</span>; 00198 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a9">CPIOERR_CHMOD_FAILED</a>: s = <span class="stringliteral">"chmod"</span>; <span class="keywordflow">break</span>; 00199 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a10">CPIOERR_CHOWN_FAILED</a>: s = <span class="stringliteral">"chown"</span>; <span class="keywordflow">break</span>; 00200 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a11">CPIOERR_WRITE_FAILED</a>: s = <span class="stringliteral">"write"</span>; <span class="keywordflow">break</span>; 00201 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a12">CPIOERR_UTIME_FAILED</a>: s = <span class="stringliteral">"utime"</span>; <span class="keywordflow">break</span>; 00202 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a13">CPIOERR_UNLINK_FAILED</a>: s = <span class="stringliteral">"unlink"</span>; <span class="keywordflow">break</span>; 00203 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a14">CPIOERR_RENAME_FAILED</a>: s = <span class="stringliteral">"rename"</span>; <span class="keywordflow">break</span>; 00204 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a15">CPIOERR_SYMLINK_FAILED</a>: s = <span class="stringliteral">"symlink"</span>; <span class="keywordflow">break</span>; 00205 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a16">CPIOERR_STAT_FAILED</a>: s = <span class="stringliteral">"stat"</span>; <span class="keywordflow">break</span>; 00206 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a17">CPIOERR_LSTAT_FAILED</a>: s = <span class="stringliteral">"lstat"</span>; <span class="keywordflow">break</span>; 00207 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a18">CPIOERR_MKDIR_FAILED</a>: s = <span class="stringliteral">"mkdir"</span>; <span class="keywordflow">break</span>; 00208 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a19">CPIOERR_RMDIR_FAILED</a>: s = <span class="stringliteral">"rmdir"</span>; <span class="keywordflow">break</span>; 00209 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a20">CPIOERR_MKNOD_FAILED</a>: s = <span class="stringliteral">"mknod"</span>; <span class="keywordflow">break</span>; 00210 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a21">CPIOERR_MKFIFO_FAILED</a>: s = <span class="stringliteral">"mkfifo"</span>; <span class="keywordflow">break</span>; 00211 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a22">CPIOERR_LINK_FAILED</a>: s = <span class="stringliteral">"link"</span>; <span class="keywordflow">break</span>; 00212 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a23">CPIOERR_READLINK_FAILED</a>: s = <span class="stringliteral">"readlink"</span>; <span class="keywordflow">break</span>; 00213 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a24">CPIOERR_READ_FAILED</a>: s = <span class="stringliteral">"read"</span>; <span class="keywordflow">break</span>; 00214 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a25">CPIOERR_COPY_FAILED</a>: s = <span class="stringliteral">"copy"</span>; <span class="keywordflow">break</span>; 00215 00216 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a26">CPIOERR_HDR_SIZE</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Header size too big"</span>); <span class="keywordflow">break</span>; 00217 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a28">CPIOERR_UNKNOWN_FILETYPE</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Unknown file type"</span>); <span class="keywordflow">break</span>; 00218 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a29">CPIOERR_MISSING_HARDLINK</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Missing hard link(s)"</span>); <span class="keywordflow">break</span>; 00219 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a30">CPIOERR_MD5SUM_MISMATCH</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"MD5 sum mismatch"</span>); <span class="keywordflow">break</span>; 00220 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a31">CPIOERR_INTERNAL</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Internal error"</span>); <span class="keywordflow">break</span>; 00221 <span class="keywordflow">case</span> <a class="code" href="group__payload.html#a24a32">CPIOERR_UNMAPPED_FILE</a>: s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"Archive file not in header"</span>); <span class="keywordflow">break</span>; 00222 } 00223 <span class="comment">/*@=branchstate@*/</span> 00224 00225 l = <span class="keyword">sizeof</span>(msg) - strlen(msg) - 1; 00226 <span class="keywordflow">if</span> (s != NULL) { 00227 <span class="keywordflow">if</span> (l > 0) strncat(msg, s, l); 00228 l -= strlen(s); 00229 } 00230 <span class="comment">/*@-branchstate@*/</span> 00231 <span class="keywordflow">if</span> ((rc & <a class="code" href="group__payload.html#a23">CPIOERR_CHECK_ERRNO</a>) && myerrno) { 00232 s = <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">" failed - "</span>); 00233 <span class="keywordflow">if</span> (l > 0) strncat(msg, s, l); 00234 l -= strlen(s); 00235 <span class="keywordflow">if</span> (l > 0) strncat(msg, <a class="code" href="popt_8c.html#a1">strerror</a>(myerrno), l); 00236 } 00237 <span class="comment">/*@=branchstate@*/</span> 00238 <span class="keywordflow">return</span> msg; 00239 } </pre></div><hr><address style="align: right;"><small>Generated on Thu Sep 12 22:14:56 2002 for rpm by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.17 </small></address> </body> </html>