Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused functions for otp #351

Merged
merged 2 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 1 addition & 55 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@
* @brief A bunch of miscellaneous functions, mostly file conversions.
*/

#include "utils.h"

#include "../misc/network.h" /* for stream_zero */
#include "pluginscheduler.h"

#include <errno.h> /* for errno() */
#include <gvm/base/prefs.h> /* for prefs_get() */
#include <stdlib.h> /* for atoi() */
#include <string.h> /* for strchr() */
#include <string.h> /* for strcmp() */
#include <sys/ioctl.h> /* for ioctl() */
#include <sys/stat.h> /* for stat() */
#include <sys/wait.h> /* for waitpid() */

extern int global_max_hosts;
Expand Down Expand Up @@ -168,51 +162,3 @@ is_scanner_only_pref (const char *pref)
return 1;
return 0;
}

/**
* @brief Writes data to a socket.
*/
static void
auth_send (int soc, char *data)
{
unsigned int sent = 0;
gsize length;

if (soc < 0)
return;

/* Convert to UTF-8 before sending to Manager. */
data = g_convert (data, -1, "UTF-8", "ISO_8859-1", NULL, &length, NULL);
while (sent < length)
{
int n = nsend (soc, data + sent, length - sent, 0);
if (n < 0)
{
if ((errno != ENOMEM) && (errno != ENOBUFS))
{
g_free (data);
return;
}
}
else
sent += n;
}
g_free (data);
}

/**
* @brief Writes data to a socket.
*/
void
send_printf (int soc, char *data, ...)
{
va_list param;
char *buffer;

va_start (param, data);
buffer = g_strdup_vprintf (data, param);
va_end (param);

auth_send (soc, buffer);
g_free (buffer);
}
3 changes: 0 additions & 3 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,4 @@ wait_for_children1 (void);
int
is_scanner_only_pref (const char *);

void
send_printf (int, char *, ...) __attribute__ ((format (printf, 2, 3)));

#endif