mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
mdev-helper: formatting code using astyle
Origin commit data
------------------
Branch: ni/coolstream
Commit: 2d89243899
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-07-05 (Mon, 05 Jul 2021)
Origin message was:
------------------
- mdev-helper: formatting code using astyle
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -31,17 +31,17 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const char *mdev_env[] =
|
const char *mdev_env[] =
|
||||||
{
|
{
|
||||||
"ACTION" ,
|
"ACTION",
|
||||||
"MDEV" ,
|
"MDEV",
|
||||||
"DEVPATH" ,
|
"DEVPATH",
|
||||||
"INTERFACE",
|
"INTERFACE",
|
||||||
"DEVNAME",
|
"DEVNAME",
|
||||||
NULL /* terminating entry */
|
NULL /* terminating entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int /*argc*/, char **argv)
|
int main(int /*argc*/, char **argv)
|
||||||
{
|
{
|
||||||
struct sockaddr_un servaddr;
|
struct sockaddr_un servaddr;
|
||||||
int clilen, sock_fd;
|
int clilen, sock_fd;
|
||||||
@@ -58,19 +58,21 @@ int main (int /*argc*/, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect(sock_fd, (struct sockaddr*) &servaddr, clilen) < 0)
|
if (connect(sock_fd, (struct sockaddr *) &servaddr, clilen) < 0)
|
||||||
{
|
{
|
||||||
//NI perror("error connect socket " NEUTRINO_UDS_NAME);
|
//NI perror("error connect socket " NEUTRINO_UDS_NAME);
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; mdev_env[i]; i++) {
|
for (unsigned i = 0; mdev_env[i]; i++)
|
||||||
char * s = getenv(mdev_env[i]);
|
{
|
||||||
|
char *s = getenv(mdev_env[i]);
|
||||||
if (s)
|
if (s)
|
||||||
data += std::string(mdev_env[i]) + "=" + s + " ";
|
data += std::string(mdev_env[i]) + "=" + s + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.empty()) {
|
if (data.empty())
|
||||||
|
{
|
||||||
printf("%s: env data empty\n", argv[0]);
|
printf("%s: env data empty\n", argv[0]);
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
@@ -81,12 +83,14 @@ int main (int /*argc*/, char **argv)
|
|||||||
head.initiatorID = CEventServer::INITID_NEUTRINO;
|
head.initiatorID = CEventServer::INITID_NEUTRINO;
|
||||||
head.dataSize = data.size() + 1;
|
head.dataSize = data.size() + 1;
|
||||||
|
|
||||||
if (write(sock_fd, &head, sizeof(head)) != sizeof(head)) {
|
if (write(sock_fd, &head, sizeof(head)) != sizeof(head))
|
||||||
|
{
|
||||||
perror("write event");
|
perror("write event");
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(sock_fd, data.c_str(), head.dataSize) != (ssize_t) head.dataSize) {
|
if (write(sock_fd, data.c_str(), head.dataSize) != (ssize_t) head.dataSize)
|
||||||
|
{
|
||||||
perror("write data");
|
perror("write data");
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user