Sponsored Content
Full Discussion: No error but not executing
Top Forums Programming No error but not executing Post 302479565 by DGPickett on Saturday 11th of December 2010 01:05:24 PM
Old 12-11-2010
I never call write() but I error check right there, check amount written, and loop if EINTR, EAGAIN if O_NONBLOCK, too, all part of the joys of raw I/O:
Code:
char *write_point ;
int char_to_write ;
int ret ;

for ( char_to_write = strlen( starting_string ), write_point = starting_string ; char_to_write ; /* nothing */ ){
  if ( 0 > ( ret = write( fd, write_point, char_to_write )){
    if ( errno == EINTR )
      continue ;
     if ( errno = EAGAIN ){
       poll( 0, 0, 1 ); /* sleep a millisecond */
       continue ;
      }
     perror( "write error" );
     exit( 1 );
   }
  write_point += ret ;
  char_to_write -= ret ;
 }

This User Gave Thanks to DGPickett For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error while executing the script

Hello I am executing the following script nawk 'NR == 1 || substr($0,63,5) ~ /H... / && \ _++ == 2 { fn && close(fn); fn = "part_" ++c; _ = 1 } { print > fn }' sample.dat When i execute as it is it is executing fine. but when i execute the whole script as a single line like below ... (2 Replies)
Discussion started by: dsdev_123
2 Replies

2. Shell Programming and Scripting

Error while executing a script

My script is as below : #!/bin/sh for line in `cat Results.txt` do FEILD1=`echo $line |awk -F"|" '{print $1}'` FEILD2=`echo $line |awk -F"|" '{print $2}'` FEILD3=`echo $line |awk -F"|" '{print $3}'` FEILD4=`echo $line |awk -F"|" '{print $4}'` echo "$FEILD1 $FIELD2 $FIELD3 $FIELD4" done ... (15 Replies)
Discussion started by: shwetainnani
15 Replies

3. UNIX for Dummies Questions & Answers

Error Executing the script.

Hi , I m getting an error after executing the script. My script. Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file). I have added public key to avoid ssh password and ssh without password working fine. #!/bin/sh fn_VMFind() { Date=`ssh -t... (5 Replies)
Discussion started by: pinga123
5 Replies

4. Programming

No error but not executing

Hi friends NO errors, but when I try to execute the program it gets struck. Can any one find it out. #include<stdio.h> #include<sys/types.h> #include<sys/mman.h> #include<stdlib.h> #include<fcntl.h> #include<sys/stat.h> #include<unistd.h> #include<signal.h> #include<string.h> ... (0 Replies)
Discussion started by: gokult
0 Replies

5. Shell Programming and Scripting

Error executing script

Please delete de thread. Thanks. (10 Replies)
Discussion started by: Rodrih92
10 Replies

6. Shell Programming and Scripting

Error while executing sh command

Hi, I have 2 files temp1.sh and temp2.sh as follows: =========== temp1.sh =========== echo "session1" sh temp2.sh echo "exit session2 and enter session1" ================================= ============= temp2.sh ============= echo "session2" sh echo "exit session2"... (5 Replies)
Discussion started by: RP09
5 Replies

7. Linux

Error executing a variable

greetings, i'll try to keep this simple... i have a script that sets up my environment and creates a command line variable to execute. when i execute the variable i get an error telling me it cannot open one of the files on the command line. the error prints a file name that is definitely... (7 Replies)
Discussion started by: crimso
7 Replies

8. UNIX for Dummies Questions & Answers

Error executing the script

I have the following script test.sh owned by dwdev account and group dwdev, the permissions on the script are as follows. -rw-r-x--- 1 dwdev dwdev 279 Sep 17 13:19 test.sh Groups: cat /etc/group | grep dwdev dwdev:x:704:dwdev dwgroup:x:725:dwdev writers:x:726:dwdev User: cat /etc/passwd |... (3 Replies)
Discussion started by: Ariean
3 Replies

9. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies

10. Red Hat

Error when executing script

Hi, I wrote this script to test if the output for DIR1 and DIR2 comes out as I want : #!/bin/bash DAY=$(date +%d) MONTH=$(date +%b) YEAR=$(date +%Y) DIR1=$($MONTH$YEAR"_Blast_BC01") DIR2=$($MONTH$YEAR"_Blast_BC15") echo $DIR1 echo $DIR2 This is the output I want for echo $DIR1 ... (12 Replies)
Discussion started by: anaigini45
12 Replies
krb5_ccache_intro(3)					      HeimdalKerberos5library					      krb5_ccache_intro(3)

NAME
krb5_ccache_intro - The credential cache functions Kerberos credential caches krb5_ccache structure holds a Kerberos credential cache. Heimdal support the follow types of credential caches: o SCC Store the credential in a database o FILE Store the credential in memory o MEMORY Store the credential in memory o API A credential cache server based solution for Mac OS X o KCM A credential cache server based solution for all platforms Example This is a minimalistic version of klist: #include <krb5.h> int main (int argc, char **argv) { krb5_context context; krb5_cc_cursor cursor; krb5_error_code ret; krb5_ccache id; krb5_creds creds; if (krb5_init_context (&context) != 0) errx(1, 'krb5_context'); ret = krb5_cc_default (context, &id); if (ret) krb5_err(context, 1, ret, 'krb5_cc_default'); ret = krb5_cc_start_seq_get(context, id, &cursor); if (ret) krb5_err(context, 1, ret, 'krb5_cc_start_seq_get'); while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){ char *principal; krb5_unparse_name(context, creds.server, &principal); printf('principal: %s ', principal); free(principal); krb5_free_cred_contents (context, &creds); } ret = krb5_cc_end_seq_get(context, id, &cursor); if (ret) krb5_err(context, 1, ret, 'krb5_cc_end_seq_get'); krb5_cc_close(context, id); krb5_free_context(context); return 0; } Version 1.5.2 11 Jan 2012 krb5_ccache_intro(3)
All times are GMT -4. The time now is 12:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy