I consider that code dangerous because, when exec fails, the child code will fall into that same loop and start making its own child processes, which will start making their own child processes -- a forkbomb. Always put an exit() after your exec()'s, just in case!
These 2 Users Gave Thanks to Corona688 For This Post:
I have the following functions but when I run SelectQmgr from a Menu Selection it doesn't do anything.
SelectQmgr ()
{
qmgrlist=`ls /var/mqm/qmgrs/ | grep -v @SYSTEM`
qmgrcount=`ls /var/mqm/qmgrs/ | grep -v @SYSTEM | wc -l`
if
then
echo "$qmgrlist QManager will be used "
... (7 Replies)
Hi,
I compiled with no error a C program, than I tryed to execute it and than I get this error:
connessione al server fallita: Address family not supported by protocol family
What does it mean?
Why I get this error only on Mac os x while on Ubuntu the program works?
The code is:... (3 Replies)
how does exec() do it? on successful call of exec() family of functions, they never return...
how to i emulate that.
assume the standard example,
execl("/bin/ls","ls",NULL);
now this would never return.
i m trying to emulate exec()'s never to return feature...
#include<unistd.h>... (4 Replies)
Hi @ all :)
i made a very little shell script witch is working well when i'm launching it directly
like with ./script
but when i'm launching it by cron tab it work at half only.
the part of the script witch are not working are:
#!/bin/sh
apt-get updade
apt-get -s upgrade >>... (5 Replies)
I have the following files in a directory
> ls -1 /tmp/test/dir/
file with spaces 1.ogg
file with spaces 2.oggI am running the following to echo the filenames but alter the file extension on the files to .mp3 instead of .ogg ( I am going to run ffmpeg against the files ultimately, but keeping... (2 Replies)
I have the following bash script lines in a file named test.sh.
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename... (3 Replies)
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Hi,
I am studying exec family of functions.Its man page says,it replaces the current process image with a new process image. If it replaces the binary,then after returning back,how does it get the previous parameters of the process which called exec?As replacing process image means replacing all... (1 Reply)
I am creating a menu currently that makes use of functions to complete each selected option but running into a bit of trouble calling them into action still fairly new with using functions correctly so any insight is appreciated. here is my code so far
#!/bin/bash
#Last updated on 05/14/14
... (4 Replies)
# Erroneous question, so can be removed. (0 Replies)
Discussion started by: beginnerboy
0 Replies
LEARN ABOUT CENTOS
getexecname
getexecname(3C) Standard C Library Functions getexecname(3C)NAME
getexecname - return pathname of executable
SYNOPSIS
#include <stdlib.h>
const char *getexecname(void);
DESCRIPTION
The getexecname() function returns the pathname (the first argument of one of the exec family of functions; see exec(2)) of the executable
that started the process.
Normally this is an absolute pathname, as the majority of commands are executed by the shells that append the command name to the user's
PATH components. If this is not an absolute path, the output of getcwd(3C) can be prepended to it to create an absolute path, unless the
process or one of its ancestors has changed its root directory or current working directory since the last successful call to one of the
exec family of functions.
RETURN VALUES
If successful, getexecname() returns a pointer to the executables pathname; otherwise, it returns 0.
USAGE
The getexecname() function obtains the executable pathname from the AT_SUN_EXECNAME aux vector. These vectors are made available to dynam-
ically linked processes only.
A successful call to one of the exec family of functions will always have AT_SUN_EXECNAME in the aux vector. The associated pathname is
guaranteed to be less than or equal to PATH_MAX, not counting the trailing null byte that is always present.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO exec(2), getcwd(3C), attributes(5)SunOS 5.10 17 Dec 1997 getexecname(3C)