alpine 3.9
obsolete weakness #543

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

cdparanoia/src/cdparanoia-III-10.2/cachetest.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.9 obsolete weakness.

   if(rollbehind==0){
    reportC("\tCache tail cursor tied to read cursor                      \n");
  }else{
    reportC("\tCache tail rollbehind: %d sector(s)                        \n",rollbehind);
  }
  reportC("\tTesting granularity of cache tail");

  while(1){
    cachegran=cachesize+1;
    for(i=0;i<10 && cachegran;){
      int sofar=0,ret=0,retry=0;
      logC("\n\t\t>>> ");
      printC(".");
      while(sofar<cachesize+1){
	ret = cdda_read_timed(d,NULL,offset+sofar,cachesize-sofar+1,&x);
	if(ret<=0)goto error2;
	logC("%d:%d:%d ",offset+sofar,ret,x);
	sofar+=ret;
      }
      
      /* Pause what we'd predict is needed to let the readahead process work. */
      {
	int usec=mspersector*readahead*1500;
	logC("\n\t\tsleeping %d microseconds",usec);
	usleep(usec);
      }
      
      /* read backwards until we seek */
      logC("\n\t\t<<< ");
      sofar=cachegran;
      while(sofar){
	sofar--;
	ret = cdda_read_timed(d,NULL,offset+sofar,1,&x);
	if(ret<=0)break;
	logC("%d:%d:%d ",offset+sofar,ret,x);
	if(x>=MIN_SEEK_MS){
	  if(cachegran == sofar+1){
	    i++;
	  }else{
	    cachegran=sofar+1;
	    i=0;
	  }
	  break;
	}
	if(sofar==0)cachegran=0;
      }

    error2:
      if(ret<=0){
	offset+=cachesize; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.