alpine 3.8
obsolete weakness #33

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:

gammu/src/gammu-1.39.0/libgammu/device/serial/ser_unx.c

Context:

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

 {
	GSM_Device_SerialData   *d = &s->Device.Data.Serial;
	int		     	ret;
	size_t		  	actual = 0;
	const unsigned char *buffer = (const unsigned char *)buf; /* Just to have correct type */

	assert(d->hPhone >= 0);

	do {
		ret = write(d->hPhone, buffer, nbytes - actual);
		if (ret < 0) {
			if (errno == EAGAIN) {
				usleep(1000);
				continue;
			}
	    		if (actual != nbytes) {
				GSM_OSErrorInfo(s, "serial_write");
				smprintf(s, "Wanted to write %ld bytes, but %ld were written\n",
					(long)nbytes, (long)actual);
			}
	    		return actual;
		}
		actual  += ret;
		buffer  += ret;
		if (s->ConnectionType == GCT_FBUS2PL2303) usleep(1000);
	} while (actual < nbytes);
	return actual;
}

GSM_Device_Functions SerialDevice = {
	serial_open,
	serial_close,
	serial_setparity,
	serial_setdtrrts,
	serial_setspeed,
	serial_read,
	serial_write
};

#endif
#endif
#endif

/* How should editor hadle tabs in this file? Add editor commands here.
 * vim: noexpandtab sw=8 ts=8 sts=8:
 */ 

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.