アットウィキロゴ

vsftpd_1.2.1_sysutil.c_vsf_sysutil_read_loop

source

sysutil.c

line

353 - 716

function


   353 int
   354 vsf_sysutil_read_loop(const int fd, void* p_buf, unsigned int size)
   355 {
   356   int retval;
   357   int num_read = 0;

    1. サイズの確認

INT_MAXよりサイズが大きい場合は、

   358   if (size > INT_MAX)
   359   {
   360     die("size too big in vsf_sysutil_read_loop");
   361   }


   362   while (1)
   363   {
   364     retval = vsf_sysutil_read(fd, (char*)p_buf + num_read, size);
   365     if (retval < 0)
   366     {
   367       return retval;
   368     }
   369     else if (retval == 0)
   370     {
   371       /* Read all we're going to read.. */
   372       return num_read;
   373     }
   374     if ((unsigned int) retval > size)
   375     {
   376       die("retval too big in vsf_sysutil_read_loop");
   377     }
   378     num_read += retval;
   379     size -= (unsigned int) retval;
   380     if (size == 0)
   381     {
   382       /* Hit the read target, cool. */
   383       return num_read;
   384     }
   385   }
   386 }
最終更新:2009年02月08日 12:43
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。